PostGIS  2.4.9dev-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.

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().

289 {
290  int 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 size_t asgeojson_srs_buf(char *output, char *srs)
POINTARRAY ** rings
Definition: liblwgeom.h:457
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:455
static size_t pointArray_to_geojson(POINTARRAY *pa, char *buf, int precision)
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:140
uint8_t flags
Definition: liblwgeom.h:452
Here is the call graph for this function:
Here is the caller graph for this function: