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

◆ asgeojson_poly_size()

static size_t asgeojson_poly_size ( const LWPOLY poly,
char *  srs,
GBOX bbox,
int  precision 
)
static

Polygon Geometry.

Definition at line 319 of file lwout_geojson.c.

320{
321 size_t size;
322 uint32_t i;
323
324 size = sizeof("{\"type\":\"Polygon\",");
325 if (srs) size += asgeojson_srs_size(srs);
326 if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(poly->flags), precision);
327 size += sizeof("\"coordinates\":[");
328 for (i=0; i<poly->nrings; i++)
329 {
330 size += pointArray_geojson_size(poly->rings[i], precision);
331 size += sizeof("[]");
332 }
333 size += sizeof(",") * i;
334 size += sizeof("]}");
335
336 return size;
337}
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.
POINTARRAY ** rings
Definition liblwgeom.h:505
uint32_t nrings
Definition liblwgeom.h:510
lwflags_t flags
Definition liblwgeom.h:507

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

Referenced by asgeojson_geom_size(), and asgeojson_poly().

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