PostGIS  3.3.9dev-r@@SVN_REVISION@@

◆ isvalidreason()

Datum isvalidreason ( PG_FUNCTION_ARGS  )

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

1571 {
1572  GSERIALIZED *geom = NULL;
1573  char *reason_str = NULL;
1574  text *result = NULL;
1575  const GEOSGeometry *g1 = NULL;
1576 
1577  geom = PG_GETARG_GSERIALIZED_P(0);
1578 
1579  initGEOS(lwpgnotice, lwgeom_geos_error);
1580 
1581  g1 = POSTGIS2GEOS(geom);
1582  if ( g1 )
1583  {
1584  reason_str = GEOSisValidReason(g1);
1585  GEOSGeom_destroy((GEOSGeometry *)g1);
1586  if (!reason_str) HANDLE_GEOS_ERROR("GEOSisValidReason");
1587  result = cstring_to_text(reason_str);
1588  GEOSFree(reason_str);
1589  }
1590  else
1591  {
1592  result = cstring_to_text(lwgeom_geos_errmsg);
1593  }
1594 
1595  PG_FREE_IF_COPY(geom, 0);
1596  PG_RETURN_POINTER(result);
1597 }
char result[OUT_DOUBLE_BUFFER_SIZE]
Definition: cu_print.c:267
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
void lwgeom_geos_error(const char *fmt,...)
#define HANDLE_GEOS_ERROR(label)
GEOSGeometry * POSTGIS2GEOS(const GSERIALIZED *pglwgeom)

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

Here is the call graph for this function: