1632 const GEOSGeometry *g1 = NULL;
1634 char *geos_reason = NULL;
1635 char *reason = NULL;
1636 GEOSGeometry *geos_location = NULL;
1639 HeapTupleHeader result;
1642 AttInMetadata *attinmeta;
1649 get_call_result_type(fcinfo, 0, &tupdesc);
1650 BlessTupleDesc(tupdesc);
1656 attinmeta = TupleDescGetAttInMetadata(tupdesc);
1658 geom = PG_GETARG_GSERIALIZED_P(0);
1660 if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
1662 flags = PG_GETARG_INT32(1);
1671 valid = GEOSisValidDetail(g1, flags,
1672 &geos_reason, &geos_location);
1673 GEOSGeom_destroy((GEOSGeometry *)g1);
1676 reason = pstrdup(geos_reason);
1677 GEOSFree(geos_reason);
1679 if ( geos_location )
1681 location =
GEOS2LWGEOM(geos_location, GEOSHasZ(geos_location));
1682 GEOSGeom_destroy((GEOSGeometry *)geos_location);
1688 lwpgerror(
"GEOS isvaliddetail() threw an exception!");
1699 values[0] = valid ?
"t" :
"f";
1707 tuple = BuildTupleFromCStrings(attinmeta, values);
1708 result = (HeapTupleHeader) palloc(tuple->t_len);
1709 memcpy(result, tuple->t_data, tuple->t_len);
1710 heap_freetuple(tuple);
1712 PG_RETURN_HEAPTUPLEHEADER(result);
char * lwgeom_to_hexwkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
void lwgeom_geos_error(const char *fmt,...)
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)