PostGIS  2.5.0beta1dev-r@@SVN_REVISION@@

◆ isvalidreason()

Datum isvalidreason ( PG_FUNCTION_ARGS  )

Definition at line 1440 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().

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