PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ parse_geojson_point()

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

Definition at line 146 of file lwin_geojson.c.

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

Referenced by parse_geojson().

147 {
148  LWGEOM *geom;
149  POINTARRAY *pa;
150  json_object* coords = NULL;
151 
152  LWDEBUGF(3, "parse_geojson_point called with root_srid = %d.", root_srid );
153 
154  coords = findMemberByName( geojson, "coordinates" );
155  if ( ! coords )
156  {
157  geojson_lwerror("Unable to find 'coordinates' in GeoJSON string", 4);
158  return NULL;
159  }
160 
161  pa = ptarray_construct_empty(1, 0, 1);
162  parse_geojson_coord(coords, hasz, pa);
163 
164  geom = (LWGEOM *) lwpoint_construct(root_srid, NULL, pa);
165  LWDEBUG(2, "parse_geojson_point finished.");
166  return geom;
167 }
POINTARRAY * ptarray_construct_empty(char hasz, char hasm, uint32_t maxpoints)
Create a new POINTARRAY with no points.
Definition: ptarray.c:70
static void geojson_lwerror(char *msg, int error_code)
Definition: lwin_geojson.c:35
#define LWDEBUG(level, msg)
Definition: lwgeom_log.h:50
static int parse_geojson_coord(json_object *poObj, int *hasz, POINTARRAY *pa)
Definition: lwin_geojson.c:83
static json_object * findMemberByName(json_object *poObj, const char *pszName)
Definition: lwin_geojson.c:45
LWPOINT * lwpoint_construct(int srid, GBOX *bbox, POINTARRAY *point)
Definition: lwpoint.c:98
#define LWDEBUGF(level, msg,...)
Definition: lwgeom_log.h:55
Here is the call graph for this function:
Here is the caller graph for this function: