PostGIS  2.2.7dev-r@@SVN_REVISION@@
static LWGEOM* parse_geojson_geometrycollection ( json_object *  geojson,
int *  hasz,
int  root_srid 
)
static

Definition at line 426 of file lwin_geojson.c.

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

Referenced by parse_geojson().

427 {
428  LWGEOM *geom = NULL;
429  int i;
430  json_object* poObjGeoms = NULL;
431 
432  if (!root_srid)
433  {
434  geom = (LWGEOM *)lwcollection_construct_empty(COLLECTIONTYPE, root_srid, 1, 0);
435  }
436  else
437  {
439  }
440 
441  poObjGeoms = findMemberByName( geojson, "geometries" );
442  if ( ! poObjGeoms )
443  {
444  geojson_lwerror("Unable to find 'geometries' in GeoJSON string", 4);
445  return NULL;
446  }
447 
448  if( json_type_array == json_object_get_type( poObjGeoms ) )
449  {
450  const int nGeoms = json_object_array_length( poObjGeoms );
451  json_object* poObjGeom = NULL;
452  for(i = 0; i < nGeoms; ++i )
453  {
454  poObjGeom = json_object_array_get_idx( poObjGeoms, i );
456  parse_geojson(poObjGeom, hasz, root_srid));
457  }
458  }
459 
460  return geom;
461 }
static LWGEOM * parse_geojson(json_object *geojson, int *hasz, int root_srid)
Definition: lwin_geojson.c:464
static void geojson_lwerror(char *msg, int error_code)
Definition: lwin_geojson.c:35
static json_object * findMemberByName(json_object *poObj, const char *pszName)
Definition: lwin_geojson.c:45
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
Definition: lwcollection.c:81
LWCOLLECTION * lwcollection_add_lwgeom(LWCOLLECTION *col, const LWGEOM *geom)
Appends geom to the collection managed by col.
Definition: lwcollection.c:174
#define COLLECTIONTYPE
Definition: liblwgeom.h:76

Here is the call graph for this function:

Here is the caller graph for this function: