PostGIS  3.2.2dev-r@@SVN_REVISION@@

◆ isvalidreason()

Datum isvalidreason ( PG_FUNCTION_ARGS  )

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

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