PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ asgeojson_collection_buf()

static size_t asgeojson_collection_buf ( const LWCOLLECTION col,
char *  srs,
char *  output,
GBOX bbox,
int  precision 
)
static

Definition at line 561 of file lwout_geojson.c.

562 {
563  uint32_t i;
564  char *ptr=output;
565  LWGEOM *subgeom;
566 
567  ptr += sprintf(ptr, "{\"type\":\"GeometryCollection\",");
568  if (srs) ptr += asgeojson_srs_buf(ptr, srs);
569  if (col->ngeoms && bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(col->flags), precision);
570  ptr += sprintf(ptr, "\"geometries\":[");
571 
572  for (i=0; i<col->ngeoms; i++)
573  {
574  if (i) ptr += sprintf(ptr, ",");
575  subgeom = col->geoms[i];
576  ptr += asgeojson_geom_buf(subgeom, ptr, NULL, precision);
577  }
578 
579  ptr += sprintf(ptr, "]}");
580 
581  return (ptr - output);
582 }
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 asgeojson_geom_buf(const LWGEOM *geom, char *output, GBOX *bbox, 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)
uint32_t ngeoms
Definition: liblwgeom.h:510
uint8_t flags
Definition: liblwgeom.h:507
LWGEOM ** geoms
Definition: liblwgeom.h:512
unsigned int uint32_t
Definition: uthash.h:78

References asgeojson_bbox_buf(), asgeojson_geom_buf(), asgeojson_srs_buf(), LWCOLLECTION::flags, FLAGS_GET_Z, LWCOLLECTION::geoms, LWCOLLECTION::ngeoms, and precision.

Referenced by asgeojson_collection().

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