PostGIS  2.1.10dev-r@@SVN_REVISION@@
static int gml_is_srid_planar ( int  srid)
static

Return 1 if given srid is planar (0 otherwise, i.e geocentric srid) Return -1 if srid is not in spatial_ref_sys.

Definition at line 320 of file lwgeom_in_gml.c.

References lwerror(), and result.

Referenced by parse_gml_srs().

321 {
322  char *result;
323  char query[256];
324  int is_planar, err;
325 
326  if (SPI_OK_CONNECT != SPI_connect ())
327  lwerror("gml_is_srid_planar: could not connect to SPI manager");
328 
329  /* A way to find if this projection is planar or geocentric */
330  sprintf(query, "SELECT position('+units=m ' in proj4text) \
331  FROM spatial_ref_sys WHERE srid='%d'", srid);
332 
333  err = SPI_exec(query, 1);
334  if (err < 0) lwerror("gml_is_srid_planar: error executing query %d", err);
335 
336  /* No entry in spatial_ref_sys */
337  if (SPI_processed <= 0)
338  {
339  SPI_finish();
340  return -1;
341  }
342 
343  result = SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1);
344  is_planar = atoi(result);
345  SPI_finish();
346 
347  return is_planar;
348 }
char ** result
Definition: liblwgeom.h:218
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Definition: lwutil.c:67

Here is the call graph for this function:

Here is the caller graph for this function: