PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

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

2799 {
2800  GSERIALIZED *geom;
2801  GEOSGeometry *g1;
2802  int result;
2803 
2804  geom = PG_GETARG_GSERIALIZED_P(0);
2805 
2806  /* Empty things can't close */
2807  if ( gserialized_is_empty(geom) )
2808  PG_RETURN_BOOL(false);
2809 
2810  initGEOS(lwpgnotice, lwgeom_geos_error);
2811 
2812  g1 = POSTGIS2GEOS(geom);
2813  if (!g1)
2814  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2815 
2816  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
2817  {
2818  GEOSGeom_destroy(g1);
2819  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
2820  }
2821 
2822  result = GEOSisRing(g1);
2823  GEOSGeom_destroy(g1);
2824 
2825  if (result == 2) HANDLE_GEOS_ERROR("GEOSisRing");
2826 
2827  PG_FREE_IF_COPY(geom, 0);
2828  PG_RETURN_BOOL(result);
2829 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:262
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,...)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)

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

Here is the call graph for this function: