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

◆ parse_geojson_multipoint()

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

Definition at line 248 of file lwin_geojson.c.

249{
250 json_object *points = parse_coordinates(geojson);
251 if (!points)
252 return NULL;
254
255 const int nPoints = json_object_array_length(points);
256 for (int i = 0; i < nPoints; ++i)
257 {
258 POINTARRAY *pa = ptarray_construct_empty(1, 0, 1);
259 json_object *coord = json_object_array_get_idx(points, i);
260 if (parse_geojson_coord(coord, hasz, pa))
261 geom = lwmpoint_add_lwpoint(geom, lwpoint_construct(0, NULL, pa));
262 else
263 {
264 lwmpoint_free(geom);
265 ptarray_free(pa);
266 return NULL;
267 }
268 }
269
270 return (LWGEOM *)geom;
271}
void lwmpoint_free(LWMPOINT *mpt)
Definition lwmpoint.c:72
LWPOINT * lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point)
Definition lwpoint.c:129
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition lwmpoint.c:45
#define MULTIPOINTTYPE
Definition liblwgeom.h:105
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition ptarray.c:59
void ptarray_free(POINTARRAY *pa)
Definition ptarray.c:327
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
static json_object * parse_coordinates(json_object *geojson)
static int parse_geojson_coord(json_object *poObj, int *hasz, POINTARRAY *pa)

References lwcollection_construct_empty(), lwmpoint_add_lwpoint(), lwmpoint_free(), lwpoint_construct(), MULTIPOINTTYPE, 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: