PostGIS  2.5.0beta2dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

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

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

Referenced by issimple().

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