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

MultiPolygon Geometry.

Definition at line 448 of file lwout_geojson.c.

References asgeojson_bbox_size(), asgeojson_srs_size(), LWMPOLY::flags, FLAGS_GET_Z, LWMPOLY::geoms, LWMPOLY::ngeoms, LWPOLY::nrings, pointArray_geojson_size(), and LWPOLY::rings.

Referenced by asgeojson_geom_size(), and asgeojson_multipolygon().

449 {
450  LWPOLY *poly;
451  int size;
452  int i, j;
453 
454  size = sizeof("{'type':'MultiPolygon',");
455  if (srs) size += asgeojson_srs_size(srs);
456  if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(mpoly->flags), precision);
457  size += sizeof("'coordinates':[]}");
458 
459  for (i=0; i < mpoly->ngeoms; i++)
460  {
461  poly = mpoly->geoms[i];
462  for (j=0 ; j <poly->nrings ; j++)
463  {
464  size += pointArray_geojson_size(poly->rings[j], precision);
465  size += sizeof("[]");
466  }
467  size += sizeof("[]");
468  }
469  size += sizeof(",") * i;
470  size += sizeof("]}");
471 
472  return size;
473 }
static size_t asgeojson_bbox_size(int hasz, int precision)
Handle Bbox.
LWPOLY ** geoms
Definition: liblwgeom.h:452
uint8_t flags
Definition: liblwgeom.h:447
POINTARRAY ** rings
Definition: liblwgeom.h:413
int nrings
Definition: liblwgeom.h:411
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
int ngeoms
Definition: liblwgeom.h:450
static size_t asgeojson_srs_size(char *srs)
Handle SRS.
Definition: lwout_geojson.c:82
static size_t pointArray_geojson_size(POINTARRAY *pa, int precision)
Returns maximum size of rendered pointarray in bytes.

Here is the call graph for this function:

Here is the caller graph for this function: