PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ parse_geojson_geometrycollection()

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

Definition at line 332 of file lwin_geojson.c.

333 {
334  json_object *poObjGeoms = findMemberByName(geojson, "geometries");
335  if (!poObjGeoms)
336  {
337  lwerror("Unable to find 'geometries' in GeoJSON string");
338  return NULL;
339  }
341 
342  if (json_type_array == json_object_get_type(poObjGeoms))
343  {
344  const int nGeoms = json_object_array_length(poObjGeoms);
345  for (int i = 0; i < nGeoms; ++i)
346  {
347  json_object *poObjGeom = json_object_array_get_idx(poObjGeoms, i);
348  LWGEOM *t = parse_geojson(poObjGeom, hasz);
349  if (t)
350  geom = (LWGEOM *)lwcollection_add_lwgeom((LWCOLLECTION *)geom, t);
351  else
352  {
353  lwgeom_free(geom);
354  return NULL;
355  }
356  }
357  }
358 
359  return geom;
360 }
#define COLLECTIONTYPE
Definition: liblwgeom.h:108
void lwgeom_free(LWGEOM *geom)
Definition: lwgeom.c:1155
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:188
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)
Definition: lwin_geojson.c:363
static json_object * findMemberByName(json_object *poObj, const char *pszName)
Definition: lwin_geojson.c:52

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: