Attempts to make an invalid geometries valid w/out losing points.
NOTE: this is only available when liblwgeom is built against GEOS 3.3.0 or higher
Definition at line 982 of file liblwgeom/lwgeom_geos_clean.c.
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(), _lwt_EdgeMotionArea(), lwgeom_clean(), mvt_geom(), rt_raster_gdal_polygonize(), rt_raster_surface(), ST_MakeValid(), and test_lwgeom_make_valid().
986 GEOSGeometry* geosout;
998 lwgeom_out = lwgeom_in;
1003 "Original geom can't be converted to GEOS (%s)" 1004 " - will try cleaning that up first",
1011 lwerror(
"Could not make a valid geometry out of input");
1019 lwerror(
"Couldn't convert POSTGIS geom to GEOS: %s",
1027 LWDEBUG(4,
"original geom converted to GEOS");
1028 lwgeom_out = lwgeom_in;
1032 GEOSGeom_destroy(geosgeom);
1039 GEOSGeom_destroy(geosout);
1045 LWDEBUG(3,
"lwgeom_make_valid: forcing multi");
1048 assert(lwgeom_in != lwgeom_out);
1049 ogeoms[0] = lwgeom_out;
1051 lwgeom_out->
srid, lwgeom_out->
bbox, 1, ogeoms);
1052 lwgeom_out->
bbox = NULL;
1056 lwgeom_out->
srid = lwgeom_in->srid;
int lwgeom_is_collection(const LWGEOM *lwgeom)
Determine whether a LWGEOM can contain sub-geometries or not.
static LWGEOM * lwgeom_make_geos_friendly(LWGEOM *geom)
LWCOLLECTION * lwcollection_construct(uint8_t type, int srid, GBOX *bbox, uint32_t ngeoms, LWGEOM **geoms)
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
#define LWDEBUG(level, msg)
static GEOSGeometry * LWGEOM_GEOS_makeValid(const GEOSGeometry *)
void lwgeom_geos_error(const char *fmt,...)
#define FLAGS_GET_Z(flags)
Macros for manipulating the 'flags' byte.
GEOSGeometry * LWGEOM2GEOS(const LWGEOM *lwgeom, int autofix)
uint8_t MULTITYPE[NUMTYPES]
Look-up for the correct MULTI* type promotion for singleton types.
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)
void * lwalloc(size_t size)
#define LWDEBUGF(level, msg,...)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.