PostGIS  3.0.6dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

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

2627 {
2628  GSERIALIZED *geom;
2629  GEOSGeometry *g1;
2630  int result;
2631 
2632  geom = PG_GETARG_GSERIALIZED_P(0);
2633 
2634  /* Empty things can't close */
2635  if ( gserialized_is_empty(geom) )
2636  PG_RETURN_BOOL(false);
2637 
2638  initGEOS(lwpgnotice, lwgeom_geos_error);
2639 
2640  g1 = POSTGIS2GEOS(geom);
2641  if (!g1)
2642  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2643 
2644  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
2645  {
2646  GEOSGeom_destroy(g1);
2647  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
2648  }
2649 
2650  result = GEOSisRing(g1);
2651  GEOSGeom_destroy(g1);
2652 
2653  if (result == 2) HANDLE_GEOS_ERROR("GEOSisRing");
2654 
2655  PG_FREE_IF_COPY(geom, 0);
2656  PG_RETURN_BOOL(result);
2657 }
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(GSERIALIZED *pglwgeom)

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

Here is the call graph for this function: