853 ret_char = GEOSisValid(gin);
863 "Geometry [%s] is valid. ",
867 return GEOSGeom_clone(gin);
871 "Geometry [%s] is still not valid: %s. " 872 "Will try to clean up further.",
881 switch (GEOSGeomTypeId(gin))
883 case GEOS_MULTIPOINT:
886 lwnotice(
"PUNTUAL geometry resulted invalid to GEOS -- dunno how to clean that up");
890 case GEOS_LINESTRING:
900 case GEOS_MULTILINESTRING:
911 case GEOS_MULTIPOLYGON:
923 case GEOS_GEOMETRYCOLLECTION:
937 char* typname = GEOSGeomType(gin);
938 lwnotice(
"ST_MakeValid: doesn't support geometry type: %s",
946 #if PARANOIA_LEVEL > 1 955 GEOSGeometry *pi, *po, *pd;
961 pi = GEOSGeom_extractUniquePoints(gin);
962 po = GEOSGeom_extractUniquePoints(gout);
963 pd = GEOSDifference(pi, po);
964 GEOSGeom_destroy(pi);
965 GEOSGeom_destroy(po);
966 loss = pd && !GEOSisEmpty(pd);
967 GEOSGeom_destroy(pd);
970 lwnotice(
"%s [%d] Vertices lost in LWGEOM_GEOS_makeValid", __FILE__, __LINE__);
static GEOSGeometry * LWGEOM_GEOS_makeValidPolygon(const GEOSGeometry *gin)
void lwnotice(const char *fmt,...)
Write a notice out to the notice handler.
char * lwgeom_to_ewkt(const LWGEOM *lwgeom)
Return an alloced string.
char lwgeom_geos_errmsg[LWGEOM_GEOS_ERRMSG_MAXSIZE]
static GEOSGeometry * LWGEOM_GEOS_makeValidLine(const GEOSGeometry *gin)
LWGEOM * GEOS2LWGEOM(const GEOSGeometry *geom, char want3d)
#define LWDEBUGF(level, msg,...)
static GEOSGeometry * LWGEOM_GEOS_makeValidMultiLine(const GEOSGeometry *gin)
void lwerror(const char *fmt,...)
Write a notice out to the error handler.
static GEOSGeometry * LWGEOM_GEOS_makeValidCollection(const GEOSGeometry *gin)