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

◆ asgeojson_poly_buf()

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

Definition at line 340 of file lwout_geojson.c.

341{
342 uint32_t i;
343
344 char *ptr=output;
345
346 ptr += sprintf(ptr, "{\"type\":\"Polygon\",");
347 if (srs) ptr += asgeojson_srs_buf(ptr, srs);
348 if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(poly->flags), precision);
349 ptr += sprintf(ptr, "\"coordinates\":[");
350 for (i=0; i<poly->nrings; i++)
351 {
352 if (i) ptr += sprintf(ptr, ",");
353 ptr += sprintf(ptr, "[");
354 ptr += pointArray_to_geojson(poly->rings[i], ptr, precision);
355 ptr += sprintf(ptr, "]");
356 }
357 ptr += sprintf(ptr, "]}");
358
359 return (ptr-output);
360}
static uint8_t precision
Definition cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Definition liblwgeom.h:179
static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision)
static size_t asgeojson_srs_buf(char *output, char *srs)
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
POINTARRAY ** rings
Definition liblwgeom.h:505
uint32_t nrings
Definition liblwgeom.h:510
lwflags_t flags
Definition liblwgeom.h:507

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

Referenced by asgeojson_geom_buf(), and asgeojson_poly().

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