229 json_object* rings = NULL;
230 json_object* points = NULL;
232 int nRings = 0, nPoints = 0;
241 if ( json_type_array != json_object_get_type(rings) )
247 nRings = json_object_array_length( rings );
255 for ( i = 0; i < nRings; i++ )
257 points = json_object_array_get_idx(rings, i);
258 if ( ! points || json_object_get_type(points) != json_type_array )
260 geojson_lwerror(
"The 'coordinates' in GeoJSON ring are not an array", 4);
263 nPoints = json_object_array_length(points);
269 for ( j = 0; j < nPoints; j++ )
271 json_object* coords = NULL;
272 coords = json_object_array_get_idx( points, j );
276 for (k = 0; k <= i; k++)
281 geojson_lwerror(
"The 'coordinates' in GeoJSON polygon are not sufficiently nested", 4);
static void geojson_lwerror(char *msg, __attribute__((__unused__)) int error_code)
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
void ptarray_free(POINTARRAY *pa)
static int parse_geojson_coord(json_object *poObj, int *hasz, POINTARRAY *pa)
LWPOLY * lwpoly_construct(int srid, GBOX *bbox, uint32_t nrings, POINTARRAY **points)
static json_object * findMemberByName(json_object *poObj, const char *pszName)
LWPOLY * lwpoly_construct_empty(int srid, char hasz, char hasm)
void * lwalloc(size_t size)