PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ gml_is_srid_planar()

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 315 of file lwgeom_in_gml.c.

Referenced by parse_gml_srs().

316 {
317  char *result;
318  char query[256];
319  int is_planar, err;
320 
321  if (SPI_OK_CONNECT != SPI_connect ())
322  lwpgerror("gml_is_srid_planar: could not connect to SPI manager");
323 
324  /* A way to find if this projection is planar or geocentric */
325  sprintf(query, "SELECT position('+units=m ' in proj4text) \
326  FROM spatial_ref_sys WHERE srid='%d'", srid);
327 
328  err = SPI_exec(query, 1);
329  if (err < 0) lwpgerror("gml_is_srid_planar: error executing query %d", err);
330 
331  /* No entry in spatial_ref_sys */
332  if (SPI_processed <= 0)
333  {
334  SPI_finish();
335  return -1;
336  }
337 
338  result = SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1);
339  is_planar = atoi(result);
340  SPI_finish();
341 
342  return is_planar;
343 }
Here is the caller graph for this function: