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

Definition at line 275 of file lwout_geojson.c.

References asgeojson_bbox_buf(), asgeojson_srs_buf(), LWPOLY::flags, FLAGS_GET_Z, LWPOLY::nrings, pointArray_to_geojson(), and LWPOLY::rings.

Referenced by asgeojson_geom_buf(), and asgeojson_poly().

276 {
277  int i;
278  char *ptr=output;
279 
280  ptr += sprintf(ptr, "{\"type\":\"Polygon\",");
281  if (srs) ptr += asgeojson_srs_buf(ptr, srs);
282  if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(poly->flags), precision);
283  ptr += sprintf(ptr, "\"coordinates\":[");
284  for (i=0; i<poly->nrings; i++)
285  {
286  if (i) ptr += sprintf(ptr, ",");
287  ptr += sprintf(ptr, "[");
288  ptr += pointArray_to_geojson(poly->rings[i], ptr, precision);
289  ptr += sprintf(ptr, "]");
290  }
291  ptr += sprintf(ptr, "]}");
292 
293  return (ptr-output);
294 }
static size_t asgeojson_srs_buf(char *output, char *srs)
Definition: lwout_geojson.c:94
POINTARRAY ** rings
Definition: liblwgeom.h:413
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
int nrings
Definition: liblwgeom.h:411
static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
uint8_t flags
Definition: liblwgeom.h:408

Here is the call graph for this function:

Here is the caller graph for this function: