PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ parse_geojson_geometrycollection()

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

Definition at line 446 of file lwin_geojson.c.

References COLLECTIONTYPE, findMemberByName(), geojson_lwerror(), lwcollection_add_lwgeom(), lwcollection_construct_empty(), and parse_geojson().

Referenced by parse_geojson().

447 {
448  LWGEOM *geom = NULL;
449  int i;
450  json_object* poObjGeoms = NULL;
451 
452  if (!root_srid)
453  {
454  geom = (LWGEOM *)lwcollection_construct_empty(COLLECTIONTYPE, root_srid, 1, 0);
455  }
456  else
457  {
459  }
460 
461  poObjGeoms = findMemberByName( geojson, "geometries" );
462  if ( ! poObjGeoms )
463  {
464  geojson_lwerror("Unable to find 'geometries' in GeoJSON string", 4);
465  return NULL;
466  }
467 
468  if( json_type_array == json_object_get_type( poObjGeoms ) )
469  {
470  const int nGeoms = json_object_array_length( poObjGeoms );
471  json_object* poObjGeom = NULL;
472  for(i = 0; i < nGeoms; ++i )
473  {
474  poObjGeom = json_object_array_get_idx( poObjGeoms, i );
476  parse_geojson(poObjGeom, hasz, root_srid));
477  }
478  }
479 
480  return geom;
481 }
static LWGEOM * parse_geojson(json_object *geojson, int *hasz, int root_srid)
Definition: lwin_geojson.c:484
static void geojson_lwerror(char *msg, __attribute__((__unused__)) int error_code)
Definition: lwin_geojson.c:55
static json_object * findMemberByName(json_object *poObj, const char *pszName)
Definition: lwin_geojson.c:65
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:94
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:187
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: