PostGIS  2.1.10dev-r@@SVN_REVISION@@
static size_t asgeojson_collection_buf ( const LWCOLLECTION col,
char *  srs,
char *  output,
GBOX bbox,
int  precision 
)
static

Definition at line 548 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().

549 {
550  int i;
551  char *ptr=output;
552  LWGEOM *subgeom;
553 
554  ptr += sprintf(ptr, "{\"type\":\"GeometryCollection\",");
555  if (srs) ptr += asgeojson_srs_buf(ptr, srs);
556  if (col->ngeoms && bbox) ptr += asgeojson_bbox_buf(ptr, bbox, FLAGS_GET_Z(col->flags), precision);
557  ptr += sprintf(ptr, "\"geometries\":[");
558 
559  for (i=0; i<col->ngeoms; i++)
560  {
561  if (i) ptr += sprintf(ptr, ",");
562  subgeom = col->geoms[i];
563  ptr += asgeojson_geom_buf(subgeom, ptr, NULL, precision);
564  }
565 
566  ptr += sprintf(ptr, "]}");
567 
568  return (ptr - output);
569 }
static size_t asgeojson_srs_buf(char *output, char *srs)
Definition: lwout_geojson.c:94
uint8_t flags
Definition: liblwgeom.h:460
LWGEOM ** geoms
Definition: liblwgeom.h:465
static size_t asgeojson_bbox_buf(char *output, GBOX *bbox, int hasz, int precision)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
Definition: liblwgeom.h:106
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: