PostGIS  2.5.1dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

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

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

Referenced by issimple().

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