PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ isvalidreason()

Datum isvalidreason ( PG_FUNCTION_ARGS  )

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

1443 {
1444  GSERIALIZED *geom = NULL;
1445  char *reason_str = NULL;
1446  text *result = NULL;
1447  const GEOSGeometry *g1 = NULL;
1448 
1449  geom = PG_GETARG_GSERIALIZED_P(0);
1450 
1451  initGEOS(lwpgnotice, lwgeom_geos_error);
1452 
1453  g1 = POSTGIS2GEOS(geom);
1454  if ( g1 )
1455  {
1456  reason_str = GEOSisValidReason(g1);
1457  GEOSGeom_destroy((GEOSGeometry *)g1);
1458  if (!reason_str) HANDLE_GEOS_ERROR("GEOSisValidReason");
1459  result = cstring_to_text(reason_str);
1460  GEOSFree(reason_str);
1461  }
1462  else
1463  {
1464  result = cstring_to_text(lwgeom_geos_errmsg);
1465  }
1466 
1467  PG_FREE_IF_COPY(geom, 0);
1468  PG_RETURN_POINTER(result);
1469 }
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
void lwgeom_geos_error(const char *fmt,...)
#define HANDLE_GEOS_ERROR(label)
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)

References HANDLE_GEOS_ERROR, lwgeom_geos_errmsg, lwgeom_geos_error(), and POSTGIS2GEOS().

Here is the call graph for this function: