Commit 482716f7 authored by Darafei Praliaskouski's avatar Darafei Praliaskouski

[raster] Fix envelope Contains shortcut in ST_Clip

Patch by Sai-bot

Closes #3457


git-svn-id: http://svn.osgeo.org/postgis/trunk@16940 b70326c6-7e19-0410-871a-916f4a2858ee
parent 6b56bcdf
Pipeline #34013372 (#2870) passed with stage
in 31 minutes and 40 seconds
......@@ -25,6 +25,7 @@ PostGIS 3.0.0
- #4191, Fix undefined behaviour in ptarray_clone_deep (Raúl Marín)
- #4211, Fix ST_Subdivide for minimal exterior ring with minimal hole (Darafei
Praliaskouski)
- #3457, Fix raster envelope shortcut in ST_Clip (Sai-bot)
PostGIS 2.5.0
2018/09/23
......
......@@ -6971,7 +6971,7 @@ CREATE OR REPLACE FUNCTION st_clip(
AS $$
BEGIN
-- short-cut if geometry's extent fully contains raster's extent
IF (nodataval IS NULL OR array_length(nodataval, 1) < 1) AND geom ~ @extschema@.ST_Envelope(rast) THEN
IF (nodataval IS NULL OR array_length(nodataval, 1) < 1) AND @extschema@.ST_Contains(geom, @extschema@.ST_Envelope(rast)) THEN
RETURN rast;
END IF;
......
......@@ -121,3 +121,5 @@ SELECT ST_SummaryStats(ST_Clip(ST_MakeEmptyRaster(42, 42, 0, 0, 1.0, 1.0, 0, 0,
-- #4102 negative nodata values don't apply on Raspberry Pi
SELECT '#4102.1', ST_BandNoDataValue(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 1, -1, 0, 0, 0), 1, '16BSI', 0, -10), 1) AS rast;
SELECT '#4102.2', ST_BandNoDataValue(ST_AddBand(ST_MakeEmptyRaster(2, 2, 0, 0, 1, -1, 0, 0, 0), 1, '32BSI', 0, -10), 1) AS rast;
select '#3457', ST_Area((ST_DumpAsPolygons(ST_Clip(ST_ASRaster(ST_GeomFromText('POLYGON((0 0,100 0,100 100,0 100,0 0))',4326),ST_Addband(ST_MakeEmptyRaster(1,1,0,0,1,-1,0,0,4326),'32BF'::text,0,-1),'32BF'::text,1,-1), ST_GeomFromText('POLYGON((0 0,100 100,100 0,0 0))',4326)))).geom);
......@@ -16,3 +16,4 @@ NOTICE: Input raster is empty or has no bands. Returning empty raster
NOTICE: Invalid band index (must use 1-based). Returning NULL
#4102.1|-10
#4102.2|-10
#3457|4950
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