PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ 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
#define MULTIPOINTTYPE
Definition: liblwgeom.h:119
LWMPOINT * lwmpoint_add_lwpoint(LWMPOINT *mobj, const LWPOINT *obj)
Definition: lwmpoint.c:45
LWPOINT * lwpoint_construct(int32_t srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:59
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int32_t srid, char hasz, char hasm)
Definition: lwcollection.c:92
void ptarray_free(POINTARRAY *pa)
Definition: ptarray.c:319
static json_object * parse_coordinates(json_object *geojson)
Definition: lwin_geojson.c:87
static int parse_geojson_coord(json_object *poObj, int *hasz, POINTARRAY *pa)
Definition: lwin_geojson.c:106

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: