PostGIS  2.5.0dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

Definition at line 2779 of file postgis/lwgeom_geos.c.

References dumpnode::geom, gserialized_is_empty(), HANDLE_GEOS_ERROR, lwgeom_geos_error(), and POSTGIS2GEOS().

Referenced by issimple().

2780 {
2781  GSERIALIZED *geom;
2782  GEOSGeometry *g1;
2783  int result;
2784 
2785  geom = PG_GETARG_GSERIALIZED_P(0);
2786 
2787  /* Empty things can't close */
2788  if ( gserialized_is_empty(geom) )
2789  PG_RETURN_BOOL(false);
2790 
2791  initGEOS(lwpgnotice, lwgeom_geos_error);
2792 
2793  g1 = POSTGIS2GEOS(geom);
2794  if (!g1)
2795  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2796 
2797  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
2798  {
2799  GEOSGeom_destroy(g1);
2800  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
2801  }
2802 
2803  result = GEOSisRing(g1);
2804  GEOSGeom_destroy(g1);
2805 
2806  if (result == 2) HANDLE_GEOS_ERROR("GEOSisRing");
2807 
2808  PG_FREE_IF_COPY(geom, 0);
2809  PG_RETURN_BOOL(result);
2810 }
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: g_serialized.c:178
LWGEOM * geom
void lwgeom_geos_error(const char *fmt,...)
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)
Here is the call graph for this function:
Here is the caller graph for this function: