PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ isvalidreason()

Datum isvalidreason ( PG_FUNCTION_ARGS  )

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

1503{
1504 GSERIALIZED *geom = NULL;
1505 char *reason_str = NULL;
1506 text *result = NULL;
1507 const GEOSGeometry *g1 = NULL;
1508
1509 geom = PG_GETARG_GSERIALIZED_P(0);
1510
1511 initGEOS(lwpgnotice, lwgeom_geos_error);
1512
1513 g1 = POSTGIS2GEOS(geom);
1514 if ( g1 )
1515 {
1516 reason_str = GEOSisValidReason(g1);
1517 GEOSGeom_destroy((GEOSGeometry *)g1);
1518 if (!reason_str) HANDLE_GEOS_ERROR("GEOSisValidReason");
1519 result = cstring_to_text(reason_str);
1520 GEOSFree(reason_str);
1521 }
1522 else
1523 {
1524 result = cstring_to_text(lwgeom_geos_errmsg);
1525 }
1526
1527 PG_FREE_IF_COPY(geom, 0);
1528 PG_RETURN_POINTER(result);
1529}
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: