351 GEOSGeometry* g1_bounds;
352 GEOSGeometry* polygons;
353 const GEOSGeometry *vgeoms[1];
374 g1_bounds = GEOSBoundary(g1);
375 if ( NULL == g1_bounds )
377 GEOSGeom_destroy(g1);
385 GEOSGeom_destroy(g1);
386 GEOSGeom_destroy(g1_bounds);
391 vgeoms[0] = GEOSUnion(g1_bounds, g2);
392 if ( NULL == vgeoms[0] )
394 GEOSGeom_destroy(g1);
395 GEOSGeom_destroy(g2);
396 GEOSGeom_destroy(g1_bounds);
401 polygons = GEOSPolygonize(vgeoms, 1);
402 if ( NULL == polygons )
404 GEOSGeom_destroy(g1);
405 GEOSGeom_destroy(g2);
406 GEOSGeom_destroy(g1_bounds);
407 GEOSGeom_destroy((GEOSGeometry*)vgeoms[0]);
412 #if PARANOIA_LEVEL > 0
415 GEOSGeom_destroy(g1);
416 GEOSGeom_destroy(g2);
417 GEOSGeom_destroy(g1_bounds);
418 GEOSGeom_destroy((GEOSGeometry*)vgeoms[0]);
419 GEOSGeom_destroy(polygons);
420 lwerror(
"%s [%s] Unexpected return from GEOSpolygonize", __FILE__, __LINE__);
429 n = GEOSGetNumGeometries(polygons);
438 const GEOSGeometry* p = GEOSGetGeometryN(polygons, i);
441 pos = GEOSPointOnSurface(p);
444 GEOSGeom_destroy(g1);
445 GEOSGeom_destroy(g2);
446 GEOSGeom_destroy(g1_bounds);
447 GEOSGeom_destroy((GEOSGeometry*)vgeoms[0]);
448 GEOSGeom_destroy(polygons);
456 GEOSGeom_destroy(g1);
457 GEOSGeom_destroy(g2);
458 GEOSGeom_destroy(g1_bounds);
459 GEOSGeom_destroy((GEOSGeometry*)vgeoms[0]);
460 GEOSGeom_destroy(polygons);
461 GEOSGeom_destroy(pos);
466 GEOSGeom_destroy(pos);
479 GEOSGeom_destroy(g1);
480 GEOSGeom_destroy(g2);
481 GEOSGeom_destroy(g1_bounds);
482 GEOSGeom_destroy((GEOSGeometry*)vgeoms[0]);
483 GEOSGeom_destroy(polygons);
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, uint8_t autofix)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, uint8_t want3d)
void lwgeom_geos_error(const char *fmt,...)
LWCOLLECTION * lwcollection_construct_empty(uint8_t type, int srid, char hasz, char hasm)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
void * lwrealloc(void *mem, size_t size)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
Datum contains(PG_FUNCTION_ARGS)