PostGIS  2.5.0dev-r@@SVN_REVISION@@
Datum isring ( PG_FUNCTION_ARGS  )

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

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

2739 {
2740  GSERIALIZED *geom;
2741  GEOSGeometry *g1;
2742  int result;
2743 
2744  geom = PG_GETARG_GSERIALIZED_P(0);
2745 
2746  /* Empty things can't close */
2747  if ( gserialized_is_empty(geom) )
2748  PG_RETURN_BOOL(false);
2749 
2750  initGEOS(lwpgnotice, lwgeom_geos_error);
2751 
2752  g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
2753  if (!g1)
2754  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2755 
2756  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
2757  {
2758  GEOSGeom_destroy(g1);
2759  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
2760  }
2761 
2762  result = GEOSisRing(g1);
2763  GEOSGeom_destroy(g1);
2764 
2765  if (result == 2) HANDLE_GEOS_ERROR("GEOSisRing");
2766 
2767  PG_FREE_IF_COPY(geom, 0);
2768  PG_RETURN_BOOL(result);
2769 }
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: