Commit e0905c13 authored by Darafei Praliaskouski's avatar Darafei Praliaskouski

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



git-svn-id: http://svn.osgeo.org/postgis/trunk@16660 b70326c6-7e19-0410-871a-916f4a2858ee
parent 5105ad46
Pipeline #26253298 passed with stage
in 21 minutes and 47 seconds
......@@ -4,6 +4,8 @@ New since PostGIS 2.5.0beta1
- #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
......
......@@ -6434,7 +6434,7 @@ CREATE OR REPLACE FUNCTION _st_intersects(geom geometry, rast raster, nband inte
RETURN TRUE;
END IF;
SELECT @extschema@.ST_Collect(t.geom) INTO _geom FROM @extschema@.ST_PixelAsPolygons(rast, nband) AS t;
SELECT @extschema@.ST_Buffer(@extschema@.ST_Collect(t.geom), 0) INTO _geom FROM @extschema@.ST_PixelAsPolygons(rast, nband) AS t;
RETURN @extschema@.ST_Intersects(geom, _geom);
END;
$$ LANGUAGE 'plpgsql' IMMUTABLE _PARALLEL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment