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

◆ parse_geojson_geometrycollection()

static LWGEOM * parse_geojson_geometrycollection ( json_object *  geojson,
int *  hasz 
)
inlinestatic

Definition at line 330 of file lwin_geojson.c.

331{
332 json_object *poObjGeoms = findMemberByName(geojson, "geometries");
333 if (!poObjGeoms)
334 {
335 lwerror("Unable to find 'geometries' in GeoJSON string");
336 return NULL;
337 }
339
340 if (json_type_array == json_object_get_type(poObjGeoms))
341 {
342 const int nGeoms = json_object_array_length(poObjGeoms);
343 for (int i = 0; i < nGeoms; ++i)
344 {
345 json_object *poObjGeom = json_object_array_get_idx(poObjGeoms, i);
346 LWGEOM *t = parse_geojson(poObjGeom, hasz);
347 if (t)
348 geom = (LWGEOM *)lwcollection_add_lwgeom((LWCOLLECTION *)geom, t);
349 else
350 {
351 lwgeom_free(geom);
352 return NULL;
353 }
354 }
355 }
356
357 return geom;
358}
#define COLLECTIONTYPE
Definition liblwgeom.h:122
void lwgeom_free(LWGEOM *geom)
Definition lwgeom.c:1138
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition lwutil.c:190
static LWGEOM * parse_geojson(json_object *geojson, int *hasz)
static json_object * findMemberByName(json_object *poObj, const char *pszName)

References COLLECTIONTYPE, findMemberByName(), lwcollection_add_lwgeom(), lwcollection_construct_empty(), lwerror(), lwgeom_free(), and parse_geojson().

Referenced by parse_geojson().

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