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

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

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