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

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

275 {
276  int i;
277  char *ptr=output;
278 
279  ptr += sprintf(ptr, "{\"type\":\"Polygon\",");
280  if (srs) ptr += asgeojson_srs_buf(ptr, srs);
281  if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(poly->flags), precision);
282  ptr += sprintf(ptr, "\"coordinates\":[");
283  for (i=0; i<poly->nrings; i++)
284  {
285  if (i) ptr += sprintf(ptr, ",");
286  ptr += sprintf(ptr, "[");
287  ptr += pointArray_to_geojson(poly->rings[i], ptr, precision);
288  ptr += sprintf(ptr, "]");
289  }
290  ptr += sprintf(ptr, "]}");
291 
292  return (ptr-output);
293 }
static size_t asgeojson_srs_buf(char *output, char *srs)
Definition: lwout_geojson.c:93
POINTARRAY ** rings
Definition: liblwgeom.h:441
uint8_t precision
Definition: cu_in_twkb.c:25
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
int nrings
Definition: liblwgeom.h:439
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:124
uint8_t flags
Definition: liblwgeom.h:436

Here is the call graph for this function:

Here is the caller graph for this function: