PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

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

2596 {
2597  GSERIALIZED *geom;
2598  GEOSGeometry *g1;
2599  int result;
2600 
2601  geom = PG_GETARG_GSERIALIZED_P(0);
2602 
2603  /* Empty things can't close */
2604  if ( gserialized_is_empty(geom) )
2605  PG_RETURN_BOOL(false);
2606 
2607  initGEOS(lwpgnotice, lwgeom_geos_error);
2608 
2609  g1 = POSTGIS2GEOS(geom);
2610  if (!g1)
2611  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2612 
2613  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
2614  {
2615  GEOSGeom_destroy(g1);
2616  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
2617  }
2618 
2619  result = GEOSisRing(g1);
2620  GEOSGeom_destroy(g1);
2621 
2622  if (result == 2) HANDLE_GEOS_ERROR("GEOSisRing");
2623 
2624  PG_FREE_IF_COPY(geom, 0);
2625  PG_RETURN_BOOL(result);
2626 }
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: g_serialized.c:179
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: