PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t asgeojson_poly_size ( const LWPOLY poly,
char *  srs,
GBOX bbox,
int  precision 
)
static

Polygon Geometry.

Definition at line 254 of file lwout_geojson.c.

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

Referenced by asgeojson_geom_size(), and asgeojson_poly().

255 {
256  size_t size;
257  int i;
258 
259  size = sizeof("{\"type\":\"Polygon\",");
260  if (srs) size += asgeojson_srs_size(srs);
261  if (bbox) size += asgeojson_bbox_size(FLAGS_GET_Z(poly->flags), precision);
262  size += sizeof("\"coordinates\":[");
263  for (i=0; i<poly->nrings; i++)
264  {
265  size += pointArray_geojson_size(poly->rings[i], precision);
266  size += sizeof("[]");
267  }
268  size += sizeof(",") * i;
269  size += sizeof("]}");
270 
271  return size;
272 }
static size_t asgeojson_bbox_size(int hasz, int precision)
Handle Bbox.
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
static size_t asgeojson_srs_size(char *srs)
Handle SRS.
Definition: lwout_geojson.c:82
uint8_t flags
Definition: liblwgeom.h:408
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: