PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t asgeojson_multipolygon_buf ( const LWMPOLY mpoly,
char *  srs,
char *  output,
GBOX bbox,
int  precision 
)
static

Definition at line 476 of file lwout_geojson.c.

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

Referenced by asgeojson_geom_buf(), and asgeojson_multipolygon().

477 {
478  LWPOLY *poly;
479  int i, j;
480  char *ptr=output;
481 
482  ptr += sprintf(ptr, "{\"type\":\"MultiPolygon\",");
483  if (srs) ptr += asgeojson_srs_buf(ptr, srs);
484  if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(mpoly->flags), precision);
485  ptr += sprintf(ptr, "\"coordinates\":[");
486  for (i=0; i<mpoly->ngeoms; i++)
487  {
488  if (i) ptr += sprintf(ptr, ",");
489  ptr += sprintf(ptr, "[");
490  poly = mpoly->geoms[i];
491  for (j=0 ; j < poly->nrings ; j++)
492  {
493  if (j) ptr += sprintf(ptr, ",");
494  ptr += sprintf(ptr, "[");
495  ptr += pointArray_to_geojson(poly->rings[j], ptr, precision);
496  ptr += sprintf(ptr, "]");
497  }
498  ptr += sprintf(ptr, "]");
499  }
500  ptr += sprintf(ptr, "]}");
501 
502  return (ptr - output);
503 }
static size_t asgeojson_srs_buf(char *output, char *srs)
Definition: lwout_geojson.c:94
LWPOLY ** geoms
Definition: liblwgeom.h:452
uint8_t flags
Definition: liblwgeom.h:447
POINTARRAY ** rings
Definition: liblwgeom.h:413
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
int nrings
Definition: liblwgeom.h:411
static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
int ngeoms
Definition: liblwgeom.h:450

Here is the call graph for this function:

Here is the caller graph for this function: