PostGIS  3.7.0dev-r@@SVN_REVISION@@

◆ isring()

Datum isring ( PG_FUNCTION_ARGS  )

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

1764 {
1765  GSERIALIZED *geom;
1766  GEOSGeometry *g1;
1767  int result;
1768 
1769  geom = PG_GETARG_GSERIALIZED_P(0);
1770 
1771  /* Empty things can't close */
1772  if ( gserialized_is_empty(geom) )
1773  PG_RETURN_BOOL(false);
1774 
1775  initGEOS(lwpgnotice, lwgeom_geos_error);
1776 
1777  g1 = POSTGIS2GEOS(geom);
1778  if (!g1)
1779  HANDLE_GEOS_ERROR("First argument geometry could not be converted to GEOS");
1780 
1781  if ( GEOSGeomTypeId(g1) != GEOS_LINESTRING )
1782  {
1783  GEOSGeom_destroy(g1);
1784  elog(ERROR, "ST_IsRing() should only be called on a linear feature");
1785  }
1786 
1787  result = GEOSisRing(g1);
1788  GEOSGeom_destroy(g1);
1789 
1790  if (result == 2) HANDLE_GEOS_ERROR("GEOSisRing");
1791 
1792  PG_FREE_IF_COPY(geom, 0);
1793  PG_RETURN_BOOL(result);
1794 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
int gserialized_is_empty(const GSERIALIZED *g)
Check if a GSERIALIZED is empty without deserializing first.
Definition: gserialized.c:181
void lwgeom_geos_error(const char *fmt,...)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)
#define HANDLE_GEOS_ERROR(label)

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

Here is the call graph for this function: