PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ asgeojson_collection()

static void asgeojson_collection ( stringbuffer_t sb,
const LWCOLLECTION col,
const geojson_opts opts 
)
static

Collection Geometry.

Definition at line 308 of file lwout_geojson.c.

309{
310 uint32_t i, ngeoms = col->ngeoms;
311
312 /* subgeometries don't get boxes or srs */
313 geojson_opts subopts = *opts;
314 subopts.bbox = NULL;
315 subopts.srs = NULL;
317
318 stringbuffer_append_len(sb, "{\"type\":\"GeometryCollection\",", 29);
319 asgeojson_srs(sb, opts);
320 if (col->ngeoms) asgeojson_bbox(sb, opts);
321 stringbuffer_append_len(sb, "\"geometries\":[", 14);
322
323 if (lwgeom_is_empty((LWGEOM*)col))
324 ngeoms = 0;
325
326 for (i=0; i<ngeoms; i++)
327 {
328 if (i) stringbuffer_append_char(sb, ',');
329 asgeojson_geometry(sb, col->geoms[i], &subopts);
330 }
331
332 stringbuffer_append_len(sb, "]}", 2);
333 return;
334}
#define LW_TRUE
Return types for functions with status returns.
Definition liblwgeom.h:93
static int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
Definition lwinline.h:199
static void asgeojson_srs(stringbuffer_t *sb, const geojson_opts *opts)
static void asgeojson_geometry(stringbuffer_t *sb, const LWGEOM *geom, const geojson_opts *opts)
static void asgeojson_bbox(stringbuffer_t *sb, const geojson_opts *opts)
static void stringbuffer_append_char(stringbuffer_t *s, char c)
static void stringbuffer_append_len(stringbuffer_t *s, const char *a, size_t alen)
Append the specified string to the stringbuffer_t using known length.
uint32_t ngeoms
Definition liblwgeom.h:580
const char * srs
int isCollectionElement

References asgeojson_bbox(), asgeojson_geometry(), asgeojson_srs(), geojson_opts::bbox, LWCOLLECTION::geoms, geojson_opts::isCollectionElement, LW_TRUE, lwgeom_is_empty(), LWCOLLECTION::ngeoms, geojson_opts::srs, stringbuffer_append_char(), and stringbuffer_append_len().

Referenced by asgeojson_geometry().

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