PostGIS  3.0.0dev-r@@SVN_REVISION@@

◆ isvalidreason()

Datum isvalidreason ( PG_FUNCTION_ARGS  )

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

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

Referenced by isvalid().

1440 {
1441  GSERIALIZED *geom = NULL;
1442  char *reason_str = NULL;
1443  text *result = NULL;
1444  const GEOSGeometry *g1 = NULL;
1445 
1446  geom = PG_GETARG_GSERIALIZED_P(0);
1447 
1448  initGEOS(lwpgnotice, lwgeom_geos_error);
1449 
1450  g1 = POSTGIS2GEOS(geom);
1451  if ( g1 )
1452  {
1453  reason_str = GEOSisValidReason(g1);
1454  GEOSGeom_destroy((GEOSGeometry *)g1);
1455  if (!reason_str) HANDLE_GEOS_ERROR("GEOSisValidReason");
1456  result = cstring_to_text(reason_str);
1457  GEOSFree(reason_str);
1458  }
1459  else
1460  {
1461  result = cstring_to_text(lwgeom_geos_errmsg);
1462  }
1463 
1464  PG_FREE_IF_COPY(geom, 0);
1465  PG_RETURN_POINTER(result);
1466 }
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:
Here is the caller graph for this function: