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

◆ parse_geojson_multilinestring()

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

Definition at line 274 of file lwin_geojson.c.

275{
276 json_object *mls = parse_coordinates(geojson);
277 if (!mls)
278 return NULL;
280 const int nLines = json_object_array_length(mls);
281 for (int i = 0; i < nLines; ++i)
282 {
283 POINTARRAY *pa = ptarray_construct_empty(1, 0, 1);
284 json_object *coords = json_object_array_get_idx(mls, i);
285
286 if (json_type_array == json_object_get_type(coords))
287 {
288 const int nPoints = json_object_array_length(coords);
289 for (int j = 0; j < nPoints; ++j)
290 {
291 json_object *coord = json_object_array_get_idx(coords, j);
292 if (!parse_geojson_coord(coord, hasz, pa))
293 {
294 lwmline_free(geom);
295 ptarray_free(pa);
296 return NULL;
297 }
298 }
299 geom = lwmline_add_lwline(geom, lwline_construct(0, NULL, pa));
300 }
301 else
302 {
303 lwmline_free(geom);
304 ptarray_free(pa);
305 return NULL;
306 }
307 }
308 return (LWGEOM *)geom;
309}
#define MULTILINETYPE
Definition liblwgeom.h:106
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: