PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asgeojson_poly_buf()

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

Definition at line 288 of file lwout_geojson.c.

289 {
290  uint32_t i;
291  char *ptr=output;
292 
293  ptr += sprintf(ptr, "{\"type\":\"Polygon\",");
294  if (srs) ptr += asgeojson_srs_buf(ptr, srs);
295  if (bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(poly->flags), precision);
296  ptr += sprintf(ptr, "\"coordinates\":[");
297  for (i=0; i<poly->nrings; i++)
298  {
299  if (i) ptr += sprintf(ptr, ",");
300  ptr += sprintf(ptr, "[");
301  ptr += pointArray_to_geojson(poly->rings[i], ptr, precision);
302  ptr += sprintf(ptr, "]");
303  }
304  ptr += sprintf(ptr, "]}");
305 
306  return (ptr-output);
307 }
static uint8_t precision
Definition: cu_in_twkb.c:25
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:140
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:460
uint32_t nrings
Definition: liblwgeom.h:458
uint8_t flags
Definition: liblwgeom.h:455
unsigned int uint32_t
Definition: uthash.h:78

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: