PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ isvalidreason()

Datum isvalidreason ( PG_FUNCTION_ARGS  )

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

1592 {
1593  GSERIALIZED *geom = NULL;
1594  char *reason_str = NULL;
1595  text *result = NULL;
1596  const GEOSGeometry *g1 = NULL;
1597 
1598  geom = PG_GETARG_GSERIALIZED_P(0);
1599 
1600  initGEOS(lwpgnotice, lwgeom_geos_error);
1601 
1602  g1 = (GEOSGeometry *)POSTGIS2GEOS(geom);
1603  if ( g1 )
1604  {
1605  reason_str = GEOSisValidReason(g1);
1606  GEOSGeom_destroy((GEOSGeometry *)g1);
1607  if (reason_str == NULL)
1608  {
1609  HANDLE_GEOS_ERROR("GEOSisValidReason");
1610  PG_RETURN_NULL(); /* never get here */
1611  }
1612  result = cstring2text(reason_str);
1613  GEOSFree(reason_str);
1614  }
1615  else
1616  {
1617  result = cstring2text(lwgeom_geos_errmsg);
1618  }
1619 
1620  PG_FREE_IF_COPY(geom, 0);
1621  PG_RETURN_POINTER(result);
1622 }
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: