[postgis-tickets] r16660 - Fix TopologyException in Raster Instersection

Darafei komzpa at gmail.com
Sun Jul 22 05:22:28 PDT 2018


Author: komzpa
Date: 2018-07-22 05:22:27 -0700 (Sun, 22 Jul 2018)
New Revision: 16660

Modified:
   trunk/NEWS
   trunk/raster/rt_pg/rtpostgis.sql.in
Log:
Fix TopologyException in Raster Instersection

Raster _st_intersects was doing ST_Collect of polygons building each pixel,
which led to invalid geometry and TopologyException.

Thanks Vinícius A.B. Schmidt for reporting and testing solutions.

Closes #4132



Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2018-07-22 05:00:46 UTC (rev 16659)
+++ trunk/NEWS	2018-07-22 12:22:27 UTC (rev 16660)
@@ -4,6 +4,8 @@
   - #4115, Fix a bug that created MVTs with incorrect property values under
     parallel plans (Raúl Marín).
   - #4120, ST_AsMVTGeom: Clip using tile coordinates (Raúl Marín).
+  - #4132, ST_Intersection on Raster now works without throwing TopologyException
+    (Vinícius A.B. Schmidt, Darafei Praliaskouski)
 
   See PostGIS 2.5.0 section for full details
 

Modified: trunk/raster/rt_pg/rtpostgis.sql.in
===================================================================
--- trunk/raster/rt_pg/rtpostgis.sql.in	2018-07-22 05:00:46 UTC (rev 16659)
+++ trunk/raster/rt_pg/rtpostgis.sql.in	2018-07-22 12:22:27 UTC (rev 16660)
@@ -6434,7 +6434,7 @@
 			RETURN TRUE;
 		END IF;
 
-		SELECT @extschema at .ST_Collect(t.geom) INTO _geom FROM @extschema at .ST_PixelAsPolygons(rast, nband) AS t;
+		SELECT @extschema at .ST_Buffer(@extschema at .ST_Collect(t.geom), 0) INTO _geom FROM @extschema at .ST_PixelAsPolygons(rast, nband) AS t;
 		RETURN @extschema at .ST_Intersects(geom, _geom);
 	END;
 	$$ LANGUAGE 'plpgsql' IMMUTABLE _PARALLEL



More information about the postgis-tickets mailing list