PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

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

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

Referenced by issimple().

2881 {
2882  GSERIALIZED *geom;
2883  GEOSGeometry *g1;
2884  int result;
2885 
2886  geom = PG_GETARG_GSERIALIZED_P(0);
2887 
2888  /* Empty things can't close */
2889  if ( gserialized_is_empty(geom) )
2890  PG_RETURN_BOOL(FALSE);
2891 
2892  initGEOS(lwpgnotice, lwgeom_geos_error);
2893 
2894  g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
2895  if ( 0 == g1 ) /* exception thrown at construction */
2896  {
2897  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
2898  PG_RETURN_NULL();
2899  }
2900 
2901  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
2902  {
2903  GEOSGeom_destroy(g1);
2904  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
2905  }
2906 
2907  result = GEOSisRing(g1);
2908  GEOSGeom_destroy(g1);
2909 
2910  if (result == 2)
2911  {
2912  HANDLE_GEOS_ERROR("GEOSisRing");
2913  PG_RETURN_NULL();
2914  }
2915 
2916  PG_FREE_IF_COPY(geom, 0);
2917  PG_RETURN_BOOL(result);
2918 }
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: g_serialized.c:179
LWGEOM * geom
void lwgeom_geos_error(const char *fmt,...)
#define FALSE
Definition: dbfopen.c:168
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: