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

◆ parse_geojson_multipoint()

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

Definition at line 246 of file lwin_geojson.c.

247{
248 json_object *points = parse_coordinates(geojson);
249 if (!points)
250 return NULL;
252
253 const int nPoints = json_object_array_length(points);
254 for (int i = 0; i < nPoints; ++i)
255 {
256 POINTARRAY *pa = ptarray_construct_empty(1, 0, 1);
257 json_object *coord = json_object_array_get_idx(points, i);
258 if (parse_geojson_coord(coord, hasz, pa))
259 geom = lwmpoint_add_lwpoint(geom, lwpoint_construct(0, NULL, pa));
260 else
261 {
262 lwmpoint_free(geom);
263 ptarray_free(pa);
264 return NULL;
265 }
266 }
267
268 return (LWGEOM *)geom;
269}
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:119
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: