PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ asgeojson_poly_size()

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

Polygon Geometry.

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

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