PostGIS  2.5.0dev-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 330 of file lwgeom_in_gml.c.

Referenced by parse_gml_srs().

331 {
332  char *result;
333  char query[256];
334  int is_planar, err;
335 
336  if (SPI_OK_CONNECT != SPI_connect ())
337  lwpgerror("gml_is_srid_planar: could not connect to SPI manager");
338 
339  /* A way to find if this projection is planar or geocentric */
340  sprintf(query, "SELECT position('+units=m ' in proj4text) \
341  FROM spatial_ref_sys WHERE srid='%d'", srid);
342 
343  err = SPI_exec(query, 1);
344  if (err < 0) lwpgerror("gml_is_srid_planar: error executing query %d", err);
345 
346  /* No entry in spatial_ref_sys */
347  if (SPI_processed <= 0)
348  {
349  SPI_finish();
350  return -1;
351  }
352 
353  result = SPI_getvalue(SPI_tuptable->vals[0], SPI_tuptable->tupdesc, 1);
354  is_planar = atoi(result);
355  SPI_finish();
356 
357  return is_planar;
358 }
Here is the caller graph for this function: