1475 const GEOSGeometry *g1 = NULL;
1477 char *geos_reason = NULL;
1478 char *reason = NULL;
1479 GEOSGeometry *geos_location = NULL;
1482 HeapTupleHeader result;
1485 AttInMetadata *attinmeta;
1492 get_call_result_type(fcinfo, 0, &tupdesc);
1493 BlessTupleDesc(tupdesc);
1499 attinmeta = TupleDescGetAttInMetadata(tupdesc);
1501 geom = PG_GETARG_GSERIALIZED_P(0);
1503 if ( PG_NARGS() > 1 && ! PG_ARGISNULL(1) )
1505 flags = PG_GETARG_INT32(1);
1514 valid = GEOSisValidDetail(g1, flags, &geos_reason, &geos_location);
1515 GEOSGeom_destroy((GEOSGeometry *)g1);
1518 reason = pstrdup(geos_reason);
1519 GEOSFree(geos_reason);
1521 if ( geos_location )
1523 location =
GEOS2LWGEOM(geos_location, GEOSHasZ(geos_location));
1524 GEOSGeom_destroy(geos_location);
1530 lwpgerror(
"GEOS isvaliddetail() threw an exception!");
1541 values[0] = valid ?
"t" :
"f";
1549 tuple = BuildTupleFromCStrings(attinmeta, values);
1550 result = (HeapTupleHeader) palloc(tuple->t_len);
1551 memcpy(result, tuple->t_data, tuple->t_len);
1552 heap_freetuple(tuple);
1554 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)