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

MultiPolygon Geometry.

Definition at line 447 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().

448 {
449  LWPOLY *poly;
450  int size;
451  int i, j;
452 
453  size = sizeof("{'type':'MultiPolygon',");
454  if (srs) size += asgeojson_srs_size(srs);
455  if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(mpoly->flags), precision);
456  size += sizeof("'coordinates':[]}");
457 
458  for (i=0; i < mpoly->ngeoms; i++)
459  {
460  poly = mpoly->geoms[i];
461  for (j=0 ; j <poly->nrings ; j++)
462  {
463  size += pointArray_geojson_size(poly->rings[j], precision);
464  size += sizeof("[]");
465  }
466  size += sizeof("[]");
467  }
468  size += sizeof(",") * i;
469  size += sizeof("]}");
470 
471  return size;
472 }
static size_t asgeojson_bbox_size(int hasz, int precision)
Handle Bbox.
LWPOLY ** geoms
Definition: liblwgeom.h:480
uint8_t flags
Definition: liblwgeom.h:475
POINTARRAY ** rings
Definition: liblwgeom.h:441
uint8_t precision
Definition: cu_in_twkb.c:25
int nrings
Definition: liblwgeom.h:439
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:124
int ngeoms
Definition: liblwgeom.h:478
static size_t asgeojson_srs_size(char *srs)
Handle SRS.
Definition: lwout_geojson.c:81
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: