PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ parse_geojson_point()

static LWGEOM* parse_geojson_point ( json_object *  geojson,
int *  hasz,
int  root_srid 
)
static

Definition at line 166 of file lwin_geojson.c.

References findMemberByName(), geojson_lwerror(), LWDEBUG, LWDEBUGF, lwpoint_construct(), parse_geojson_coord(), and ptarray_construct_empty().

Referenced by parse_geojson().

167 {
168  LWGEOM *geom;
169  POINTARRAY *pa;
170  json_object* coords = NULL;
171 
172  LWDEBUGF(3, "parse_geojson_point called with root_srid = %d.", root_srid );
173 
174  coords = findMemberByName( geojson, "coordinates" );
175  if ( ! coords )
176  {
177  geojson_lwerror("Unable to find 'coordinates' in GeoJSON string", 4);
178  return NULL;
179  }
180 
181  pa = ptarray_construct_empty(1, 0, 1);
182  parse_geojson_coord(coords, hasz, pa);
183 
184  geom = (LWGEOM *) lwpoint_construct(root_srid, NULL, pa);
185  LWDEBUG(2, "parse_geojson_point finished.");
186  return geom;
187 }
static void geojson_lwerror(char *msg, __attribute__((__unused__)) int error_code)
Definition: lwin_geojson.c:55
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:70
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:83
static int parse_geojson_coord(json_object *poObj, int *hasz, POINTARRAY *pa)
Definition: lwin_geojson.c:103
static json_object * findMemberByName(json_object *poObj, const char *pszName)
Definition: lwin_geojson.c:65
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:129
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:88
Here is the call graph for this function:
Here is the caller graph for this function: