PostGIS  2.3.7dev-r@@SVN_REVISION@@
Datum isvalidreason ( PG_FUNCTION_ARGS  )

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

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

1517 {
1518  GSERIALIZED *geom = NULL;
1519  char *reason_str = NULL;
1520  text *result = NULL;
1521  const GEOSGeometry *g1 = NULL;
1522 
1523  geom = PG_GETARG_GSERIALIZED_P(0);
1524 
1525  initGEOS(lwpgnotice, lwgeom_geos_error);
1526 
1527  g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
1528  if ( g1 )
1529  {
1530  reason_str = GEOSisValidReason(g1);
1531  GEOSGeom_destroy((GEOSGeometry *)g1);
1532  if (reason_str == NULL)
1533  {
1534  HANDLE_GEOS_ERROR("GEOSisValidReason");
1535  PG_RETURN_NULL(); /* never get here */
1536  }
1537  result = cstring2text(reason_str);
1538  GEOSFree(reason_str);
1539  }
1540  else
1541  {
1542  result = cstring2text(lwgeom_geos_errmsg);
1543  }
1544 
1545  PG_FREE_IF_COPY(geom, 0);
1546  PG_RETURN_POINTER(result);
1547 }
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
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: