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

◆ parse_geojson_multilinestring()

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

Definition at line 272 of file lwin_geojson.c.

273{
274 json_object *mls = parse_coordinates(geojson);
275 if (!mls)
276 return NULL;
278 const int nLines = json_object_array_length(mls);
279 for (int i = 0; i < nLines; ++i)
280 {
281 POINTARRAY *pa = ptarray_construct_empty(1, 0, 1);
282 json_object *coords = json_object_array_get_idx(mls, i);
283
284 if (json_type_array == json_object_get_type(coords))
285 {
286 const int nPoints = json_object_array_length(coords);
287 for (int j = 0; j < nPoints; ++j)
288 {
289 json_object *coord = json_object_array_get_idx(coords, j);
290 if (!parse_geojson_coord(coord, hasz, pa))
291 {
292 lwmline_free(geom);
293 ptarray_free(pa);
294 return NULL;
295 }
296 }
297 geom = lwmline_add_lwline(geom, lwline_construct(0, NULL, pa));
298 }
299 else
300 {
301 lwmline_free(geom);
302 ptarray_free(pa);
303 return NULL;
304 }
305 }
306 return (LWGEOM *)geom;
307}
#define MULTILINETYPE
Definition liblwgeom.h:120
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition ptarray.c:59
LWLINE * lwline_construct(int32_t srid, GBOX *bbox, POINTARRAY *points)
Definition lwline.c:42
LWMLINE * lwmline_add_lwline(LWMLINE *mobj, const LWLINE *obj)
Definition lwmline.c:46
void ptarray_free(POINTARRAY *pa)
Definition ptarray.c:327
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
void lwmline_free(LWMLINE *mline)
Definition lwmline.c:112
static json_object * parse_coordinates(json_object *geojson)
static int parse_geojson_coord(json_object *poObj, int *hasz, POINTARRAY *pa)

References lwcollection_construct_empty(), lwline_construct(), lwmline_add_lwline(), lwmline_free(), MULTILINETYPE, parse_coordinates(), parse_geojson_coord(), ptarray_construct_empty(), and ptarray_free().

Referenced by parse_geojson().

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