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

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

Referenced by asgeojson_collection().

562 {
563  int 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 size_t asgeojson_srs_buf(char *output, char *srs)
uint8_t flags
Definition: liblwgeom.h:504
LWGEOM ** geoms
Definition: liblwgeom.h:509
uint8_t precision
Definition: cu_in_twkb.c:25
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
#define FLAGS_GET_Z(flags)
Macros for manipulating the &#39;flags&#39; byte.
Definition: liblwgeom.h:140
static size_t asgeojson_geom_buf(const LWGEOM *geom, char *output, GBOX *bbox, int precision)
Here is the call graph for this function:
Here is the caller graph for this function: