1535 const GEOSGeometry *g1 = NULL;
1537 char *geos_reason = NULL;
1538 char *reason = NULL;
1539 GEOSGeometry *geos_location = NULL;
1542 HeapTupleHeader result;
1545 AttInMetadata *attinmeta;
1552 get_call_result_type(fcinfo, 0, &tupdesc);
1553 BlessTupleDesc(tupdesc);
1559 attinmeta = TupleDescGetAttInMetadata(tupdesc);
1561 geom = PG_GETARG_GSERIALIZED_P(0);
1562 flags = PG_GETARG_INT32(1);
1570 valid = GEOSisValidDetail(g1, flags, &geos_reason, &geos_location);
1571 GEOSGeom_destroy((GEOSGeometry *)g1);
1574 reason = pstrdup(geos_reason);
1575 GEOSFree(geos_reason);
1577 if ( geos_location )
1579 location =
GEOS2LWGEOM(geos_location, GEOSHasZ(geos_location));
1580 GEOSGeom_destroy(geos_location);
1586 lwpgerror(
"GEOS isvaliddetail() threw an exception!");
1597 values[0] = valid ?
"t" :
"f";
1605 tuple = BuildTupleFromCStrings(attinmeta, values);
1606 result = (HeapTupleHeader) palloc(tuple->t_len);
1607 memcpy(result, tuple->t_data, tuple->t_len);
1608 heap_freetuple(tuple);
1610 PG_RETURN_HEAPTUPLEHEADER(result);
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, uint8_t want3d)
void lwgeom_geos_error(const char *fmt,...)
char * lwgeom_to_hexwkb(const LWGEOM *geom, uint8_t variant, size_t *size_out)
GEOSGeometry * POSTGIS2GEOS(GSERIALIZED *pglwgeom)