PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ asgeojson_multipolygon_size()

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

MultiPolygon Geometry.

Definition at line 514 of file lwout_geojson.c.

515{
516 LWPOLY *poly;
517 int size;
518 uint32_t i, j;
519
520 size = sizeof("{'type':'MultiPolygon',");
521 if (srs) size += asgeojson_srs_size(srs);
522 if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(mpoly->flags), precision);
523 size += sizeof("'coordinates':[]}");
524
525 for (i=0; i < mpoly->ngeoms; i++)
526 {
527 poly = mpoly->geoms[i];
528 for (j=0 ; j <poly->nrings ; j++)
529 {
530 size += pointArray_geojson_size(poly->rings[j], precision);
531 size += sizeof("[]");
532 }
533 size += sizeof("[]");
534 }
535 size += sizeof(",") * i;
536 size += sizeof("]}");
537
538 return size;
539}
static uint8_t precision
Definition cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:179
static size_t pointArray_geojson_size(POINTARRAY *pa, int precision)
Returns maximum size of rendered pointarray in bytes.
static size_t asgeojson_srs_size(char *srs)
Handle SRS.
static size_t asgeojson_bbox_size(int hasz, int precision)
Handle Bbox.
uint32_t ngeoms
Definition liblwgeom.h:552
LWPOLY ** geoms
Definition liblwgeom.h:547
lwflags_t flags
Definition liblwgeom.h:549
POINTARRAY ** rings
Definition liblwgeom.h:505
uint32_t nrings
Definition liblwgeom.h:510

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

Referenced by asgeojson_geom_size(), and asgeojson_multipolygon().

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