[postgis-tickets] r16671 - Remove geometry autofix behavior

Daniel Baston dbaston at gmail.com
Wed Jul 25 01:34:03 PDT 2018


Author: dbaston
Date: 2018-07-25 13:34:03 -0700 (Wed, 25 Jul 2018)
New Revision: 16671

Modified:
   trunk/NEWS
   trunk/doc/reference_processing.xml
   trunk/liblwgeom/lwgeom_geos.c
   trunk/regress/clipbybox2d_expected
   trunk/regress/tickets_expected
Log:
Remove geometry autofix behavior

References #4040
Closes https://github.com/postgis/postgis/pull/268



Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2018-07-25 20:15:43 UTC (rev 16670)
+++ trunk/NEWS	2018-07-25 20:34:03 UTC (rev 16671)
@@ -90,9 +90,6 @@
   - #2508, ST_OffsetCurve now works with collections (Darafei Praliaskouski)
   - #4006, ST_GeomFromGeoJSON support for json and jsonb as input
            (Paul Ramsey, Regina Obe)
-  - #4037, Invalid input geometry is fixed with MakeValid for GEOS exceptions in
-           ST_Intersection, ST_Union, ST_Difference, ST_SymDifference (Darafei
-           Praliaskouski)
   - #4038, ST_Subdivide now selects pivot for geometry split that reuses input
            vertices. ST_ClipByBox2D is stubbed with ST_Intersection because of
            robustness issues. (Darafei Praliaskouski)
@@ -105,7 +102,6 @@
   - #4084: Fixed wrong code-comment regarding front/back of BOX3D (Matthias Bay)
   - #4060, #4094, PostgreSQL JIT support (Raúl Marín, Laurenz Albe)
   - #3960, ST_Centroid now uses lwgeom_centroid (Darafei Praliaskouski)
-  - #4103, ST_PointOnSurface can handle invalid (Darafei Praliaskouski)
   - #4027, Remove duplicated code in lwgeom_geos (Darafei Praliaskouski,
            Daniel Baston)
   - #4115, Fix a bug that created MVTs with incorrect property values under

Modified: trunk/doc/reference_processing.xml
===================================================================
--- trunk/doc/reference_processing.xml	2018-07-25 20:15:43 UTC (rev 16670)
+++ trunk/doc/reference_processing.xml	2018-07-25 20:34:03 UTC (rev 16671)
@@ -490,16 +490,14 @@
 		<title>Description</title>
 
     <para>
-Clips a geometry by a 2D box. The output geometry is not guaranteed to be valid
-(self-intersections for a polygon may be introduced).
-Topologically invalid input geometries do not result in exceptions being thrown.
-    </para>
+Clips a geometry by a 2D box.</para>
 
 		<para>Performed by the GEOS module.</para>
 		<note><para>Requires GEOS 3.5.0+</para></note>
 
 		<para>Availability: 2.2.0 - requires GEOS >= 3.5.0.</para>
-		<para>Changed: 2.5.0 - wrapper around ST_Intersection to work around GEOS bugs. </para>
+                <para>Changed: 2.5.0 - wrapper around ST_Intersection to work around GEOS bugs.
+                      No longer supports invalid input geometry.</para>
 
 	  </refsection>
 

Modified: trunk/liblwgeom/lwgeom_geos.c
===================================================================
--- trunk/liblwgeom/lwgeom_geos.c	2018-07-25 20:15:43 UTC (rev 16670)
+++ trunk/liblwgeom/lwgeom_geos.c	2018-07-25 20:34:03 UTC (rev 16671)
@@ -618,24 +618,6 @@
 
 	g3 = GEOSIntersection(g1, g2);
 
-	if (!g3)
-	{
-		GEOSGeometry *g1v, *g2v;
-		lwnotice("%s: GEOS Error: %s", __func__, lwgeom_geos_errmsg);
-
-		if (!GEOSisValid(g1) || !GEOSisValid(g2))
-		{
-			lwnotice(
-			    "Your geometry dataset is not valid per OGC Specification. "
-			    "Please fix it with manual review of entries that are not ST_IsValid(geom). "
-			    "Retrying GEOS operation with ST_MakeValid of your input.");
-			g1v = LWGEOM_GEOS_makeValid(g1);
-			g2v = LWGEOM_GEOS_makeValid(g2);
-			g3 = GEOSIntersection(g1v, g2v);
-			GEOS_FREE(g1v, g2v);
-		}
-	}
-
 	if (!g3) GEOS_FREE_AND_FAIL(g1);
 	GEOSSetSRID(g3, srid);
 
@@ -730,24 +712,6 @@
 
 	g3 = GEOSDifference(g1, g2);
 
-	if (!g3)
-	{
-		GEOSGeometry *g1v, *g2v;
-		lwnotice("%s: GEOS Error: %s", __func__, lwgeom_geos_errmsg);
-
-		if (!GEOSisValid(g1) || !GEOSisValid(g2))
-		{
-			lwnotice(
-			    "Your geometry dataset is not valid per OGC Specification. "
-			    "Please fix it with manual review of entries that are not ST_IsValid(geom). "
-			    "Retrying GEOS operation with ST_MakeValid of your input.");
-			g1v = LWGEOM_GEOS_makeValid(g1);
-			g2v = LWGEOM_GEOS_makeValid(g2);
-			g3 = GEOSDifference(g1v, g2v);
-			GEOS_FREE(g1v, g2v);
-		}
-	}
-
 	if (!g3) GEOS_FREE_AND_FAIL(g1, g2);
 	GEOSSetSRID(g3, srid);
 
@@ -781,24 +745,6 @@
 
 	g3 = GEOSSymDifference(g1, g2);
 
-	if (!g3)
-	{
-		GEOSGeometry *g1v, *g2v;
-		lwnotice("%s: GEOS Error: %s", __func__, lwgeom_geos_errmsg);
-
-		if (!GEOSisValid(g1) || !GEOSisValid(g2))
-		{
-			lwnotice(
-			    "Your geometry dataset is not valid per OGC Specification. "
-			    "Please fix it with manual review of entries that are not ST_IsValid(geom). "
-			    "Retrying GEOS operation with ST_MakeValid of your input.");
-			g1v = LWGEOM_GEOS_makeValid(g1);
-			g2v = LWGEOM_GEOS_makeValid(g2);
-			g3 = GEOSSymDifference(g1v, g2v);
-			GEOS_FREE(g1v, g2v);
-		}
-	}
-
 	if (!g3) GEOS_FREE_AND_FAIL(g1, g2);
 	GEOSSetSRID(g3, srid);
 
@@ -864,23 +810,6 @@
 
 	g3 = GEOSPointOnSurface(g1);
 
-	if (!g3)
-	{
-		GEOSGeometry *g1v;
-		lwnotice("%s: GEOS Error: %s", __func__, lwgeom_geos_errmsg);
-
-		if (!GEOSisValid(g1))
-		{
-			lwnotice(
-			    "Your geometry dataset is not valid per OGC Specification. "
-			    "Please fix it with manual review of entries that are not ST_IsValid(geom). "
-			    "Retrying GEOS operation with ST_MakeValid of your input.");
-			g1v = LWGEOM_GEOS_makeValid(g1);
-			g3 = GEOSPointOnSurface(g1v);
-			GEOS_FREE(g1v);
-		}
-	}
-
 	if (!g3) GEOS_FREE_AND_FAIL(g1);
 	GEOSSetSRID(g3, srid);
 
@@ -915,24 +844,6 @@
 
 	g3 = GEOSUnion(g1, g2);
 
-	if (!g3)
-	{
-		GEOSGeometry *g1v, *g2v;
-		lwnotice("%s: GEOS Error: %s", __func__, lwgeom_geos_errmsg);
-
-		if (!GEOSisValid(g1) || !GEOSisValid(g2))
-		{
-			lwnotice(
-			    "Your geometry dataset is not valid per OGC Specification. "
-			    "Please fix it with manual review of entries that are not ST_IsValid(geom). "
-			    "Retrying GEOS operation with ST_MakeValid of your input.");
-			g1v = LWGEOM_GEOS_makeValid(g1);
-			g2v = LWGEOM_GEOS_makeValid(g2);
-			g3 = GEOSUnion(g1v, g2v);
-			GEOS_FREE(g1v, g2v);
-		}
-	}
-
 	if (!g3) GEOS_FREE_AND_FAIL(g1, g2);
 	GEOSSetSRID(g3, srid);
 

Modified: trunk/regress/clipbybox2d_expected
===================================================================
--- trunk/regress/clipbybox2d_expected	2018-07-25 20:15:43 UTC (rev 16670)
+++ trunk/regress/clipbybox2d_expected	2018-07-25 20:34:03 UTC (rev 16671)
@@ -2,11 +2,7 @@
 2|BOX(5 5,8 8)
 3|BOX(2 2,8 8)
 4|MULTIPOINT(0 0,2 2)
-NOTICE:  lwgeom_intersection: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
-NOTICE:  Self-intersection
-NOTICE:  Your geometry dataset is not valid per OGC Specification. Please fix it with manual review of entries that are not ST_IsValid(geom). Retrying GEOS operation with ST_MakeValid of your input.
-NOTICE:  Self-intersection
-5|MULTIPOLYGON(((2 2,5 5,8 2,2 2)),((5 5,2 8,8 8,5 5)))
+ERROR:  lwgeom_intersection: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
 6|MULTIPOLYGON(((2.5 2,5 4,5 5,10 5,10 2,2.5 2)))
 7|POLYGON((2 2,2 5,5 5,5 2,2 2))
 8|SRID=3857;POLYGON EMPTY

Modified: trunk/regress/tickets_expected
===================================================================
--- trunk/regress/tickets_expected	2018-07-25 20:15:43 UTC (rev 16670)
+++ trunk/regress/tickets_expected	2018-07-25 20:34:03 UTC (rev 16671)
@@ -326,32 +326,12 @@
 #4011|ST_MultiLineString|MULTILINESTRING EMPTY|t|t
 #4011|ST_GeometryCollection|MULTILINESTRING((0 0,0 0))|f|f
 #4025|
-NOTICE:  lwgeom_intersection: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
-NOTICE:  Self-intersection
-NOTICE:  Your geometry dataset is not valid per OGC Specification. Please fix it with manual review of entries that are not ST_IsValid(geom). Retrying GEOS operation with ST_MakeValid of your input.
-NOTICE:  Self-intersection
-#4037.1|MULTIPOLYGON(((2 2,5 5,8 2,2 2)),((5 5,2 8,8 8,5 5)))
-NOTICE:  lwgeom_difference: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
-NOTICE:  Self-intersection
-NOTICE:  Your geometry dataset is not valid per OGC Specification. Please fix it with manual review of entries that are not ST_IsValid(geom). Retrying GEOS operation with ST_MakeValid of your input.
-NOTICE:  Self-intersection
-#4037.2|MULTIPOLYGON(((0 0,2 2,8 2,10 0,0 0)),((2 8,0 10,10 10,8 8,2 8)))
-NOTICE:  lwgeom_symdifference: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
-NOTICE:  Self-intersection
-NOTICE:  Your geometry dataset is not valid per OGC Specification. Please fix it with manual review of entries that are not ST_IsValid(geom). Retrying GEOS operation with ST_MakeValid of your input.
-NOTICE:  Self-intersection
-#4037.3|MULTIPOLYGON(((0 0,2 2,8 2,10 0,0 0)),((5 5,2 2,2 8,5 5)),((8 2,5 5,8 8,8 2)),((2 8,0 10,10 10,8 8,2 8)))
-NOTICE:  lwgeom_union: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
-NOTICE:  Self-intersection
-NOTICE:  Your geometry dataset is not valid per OGC Specification. Please fix it with manual review of entries that are not ST_IsValid(geom). Retrying GEOS operation with ST_MakeValid of your input.
-NOTICE:  Self-intersection
-#4037.4|POLYGON((0 0,2 2,2 8,0 10,10 10,8 8,8 2,10 0,0 0))
+ERROR:  lwgeom_intersection: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
+ERROR:  lwgeom_difference: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
+ERROR:  lwgeom_symdifference: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
+ERROR:  lwgeom_union: GEOS Error: TopologyException: Input geom 0 is invalid: Self-intersection
 #4055a|4326
 #4055b|4326
 #4089|LINESTRING Z (1 1 1,3 3 1)
-NOTICE:  lwgeom_pointonsurface: GEOS Error: TopologyException: Input geom 1 is invalid: Self-intersection
-NOTICE:  Self-intersection
-NOTICE:  Your geometry dataset is not valid per OGC Specification. Please fix it with manual review of entries that are not ST_IsValid(geom). Retrying GEOS operation with ST_MakeValid of your input.
-NOTICE:  Self-intersection
-#4103|t
+ERROR:  lwgeom_pointonsurface: GEOS Error: TopologyException: Input geom 1 is invalid: Self-intersection
 #4081|f|t



More information about the postgis-tickets mailing list