PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asgeojson_multipolygon_buf()

static size_t asgeojson_multipolygon_buf ( const LWMPOLY mpoly,
char *  srs,
char *  output,
GBOX bbox,
int  precision 
)
static

Definition at line 489 of file lwout_geojson.c.

490 {
491  LWPOLY *poly;
492  uint32_t i, j;
493  char *ptr=output;
494 
495  ptr += sprintf(ptr, "{\"type\":\"MultiPolygon\",");
496  if (srs) ptr += asgeojson_srs_buf(ptr, srs);
497  if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(mpoly->flags), precision);
498  ptr += sprintf(ptr, "\"coordinates\":[");
499  for (i=0; i<mpoly->ngeoms; i++)
500  {
501  if (i) ptr += sprintf(ptr, ",");
502  ptr += sprintf(ptr, "[");
503  poly = mpoly->geoms[i];
504  for (j=0 ; j < poly->nrings ; j++)
505  {
506  if (j) ptr += sprintf(ptr, ",");
507  ptr += sprintf(ptr, "[");
508  ptr += pointArray_to_geojson(poly->rings[j], ptr, precision);
509  ptr += sprintf(ptr, "]");
510  }
511  ptr += sprintf(ptr, "]");
512  }
513  ptr += sprintf(ptr, "]}");
514 
515  return (ptr - output);
516 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision)
static size_t asgeojson_srs_buf(char *output, char *srs)
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
uint8_t flags
Definition: liblwgeom.h:494
uint32_t ngeoms
Definition: liblwgeom.h:497
LWPOLY ** geoms
Definition: liblwgeom.h:499
POINTARRAY ** rings
Definition: liblwgeom.h:460
uint32_t nrings
Definition: liblwgeom.h:458
unsigned int uint32_t
Definition: uthash.h:78

References asgeojson_bbox_buf(), asgeojson_srs_buf(), LWMPOLY::flags, FLAGS_GET_Z, LWMPOLY::geoms, LWMPOLY::ngeoms, LWPOLY::nrings, pointArray_to_geojson(), precision, and LWPOLY::rings.

Referenced by asgeojson_geom_buf(), and asgeojson_multipolygon().

Here is the call graph for this function:
Here is the caller graph for this function: