Attempts to make an invalid geometries valid w/out losing points.
Definition at line 854 of file liblwgeom/lwgeom_geos_clean.c.
858 GEOSGeometry* geosout;
870 lwgeom_out = lwgeom_in;
875 "Original geom can't be converted to GEOS (%s)"
876 " - will try cleaning that up first",
880 if (!lwgeom_out)
lwerror(
"Could not make a valid geometry out of input");
893 LWDEBUG(4,
"original geom converted to GEOS");
894 lwgeom_out = lwgeom_in;
897 #if POSTGIS_GEOS_VERSION < 38
900 geosout = GEOSMakeValid(geosgeom);
902 GEOSGeom_destroy(geosgeom);
903 if (!geosout)
return NULL;
906 GEOSGeom_destroy(geosout);
912 LWDEBUG(3,
"lwgeom_make_valid: forcing multi");
915 assert(lwgeom_in != lwgeom_out);
916 ogeoms[0] = lwgeom_out;
919 lwgeom_out->
bbox = NULL;
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,...)
GEOSGeometry * LWGEOM_GEOS_makeValid(const GEOSGeometry *)
static LWGEOM * lwgeom_make_geos_friendly(LWGEOM *geom)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
void * lwalloc(size_t size)
uint8_t MULTITYPE[NUMTYPES]
Look-up for the correct MULTI* type promotion for singleton types.
#define LWDEBUG(level, msg)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
References LWGEOM::bbox, LWGEOM::flags, FLAGS_GET_Z, GEOS2LWGEOM(), lwalloc(), lwcollection_construct(), LWDEBUG, LWDEBUGF, lwerror(), LWGEOM2GEOS(), lwgeom_geos_errmsg, lwgeom_geos_error(), LWGEOM_GEOS_makeValid(), lwgeom_is_collection(), lwgeom_make_geos_friendly(), MULTITYPE, LWGEOM::srid, and LWGEOM::type.
Referenced by _lwt_AddLineEdge(), lwgeom_clean(), mvt_safe_clip_polygon_by_box(), rt_raster_gdal_polygonize(), rt_raster_surface(), ST_MakeValid(), test_geos_makevalid(), and test_lwgeom_make_valid().