PostGIS  3.1.6dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

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

2785 {
2786  GSERIALIZED *geom;
2787  GEOSGeometry *g1;
2788  int result;
2789 
2790  geom = PG_GETARG_GSERIALIZED_P(0);
2791 
2792  /* Empty things can't close */
2793  if ( gserialized_is_empty(geom) )
2794  PG_RETURN_BOOL(false);
2795 
2796  initGEOS(lwpgnotice, lwgeom_geos_error);
2797 
2798  g1 = POSTGIS2GEOS(geom);
2799  if (!g1)
2800  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2801 
2802  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
2803  {
2804  GEOSGeom_destroy(g1);
2805  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
2806  }
2807 
2808  result = GEOSisRing(g1);
2809  GEOSGeom_destroy(g1);
2810 
2811  if (result == 2) HANDLE_GEOS_ERROR("GEOSisRing");
2812 
2813  PG_FREE_IF_COPY(geom, 0);
2814  PG_RETURN_BOOL(result);
2815 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: gserialized.c:152
void lwgeom_geos_error(const char *fmt,...)
#define HANDLE_GEOS_ERROR(label)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)

References gserialized_is_empty(), HANDLE_GEOS_ERROR, lwgeom_geos_error(), POSTGIS2GEOS(), and result.

Here is the call graph for this function: