[postgis-tickets] r16940 - [raster] Fix envelope Contains shortcut in ST_Clip

Darafei komzpa at gmail.com
Tue Oct 23 05:58:03 PDT 2018


Author: komzpa
Date: 2018-10-23 05:58:02 -0700 (Tue, 23 Oct 2018)
New Revision: 16940

Modified:
   trunk/NEWS
   trunk/raster/rt_pg/rtpostgis.sql.in
   trunk/raster/test/regress/tickets.sql
   trunk/raster/test/regress/tickets_expected
Log:
[raster] Fix envelope Contains shortcut in ST_Clip

Patch by Sai-bot

Closes #3457


Modified: trunk/NEWS
===================================================================
--- trunk/NEWS	2018-10-23 12:19:59 UTC (rev 16939)
+++ trunk/NEWS	2018-10-23 12:58:02 UTC (rev 16940)
@@ -25,6 +25,7 @@
   - #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

Modified: trunk/raster/rt_pg/rtpostgis.sql.in
===================================================================
--- trunk/raster/rt_pg/rtpostgis.sql.in	2018-10-23 12:19:59 UTC (rev 16939)
+++ trunk/raster/rt_pg/rtpostgis.sql.in	2018-10-23 12:58:02 UTC (rev 16940)
@@ -6971,7 +6971,7 @@
  	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 at .ST_Envelope(rast) THEN
+		IF (nodataval IS NULL OR array_length(nodataval, 1) < 1) AND @extschema at .ST_Contains(geom, @extschema at .ST_Envelope(rast)) THEN
 			RETURN rast;
 		END IF;
 

Modified: trunk/raster/test/regress/tickets.sql
===================================================================
--- trunk/raster/test/regress/tickets.sql	2018-10-23 12:19:59 UTC (rev 16939)
+++ trunk/raster/test/regress/tickets.sql	2018-10-23 12:58:02 UTC (rev 16940)
@@ -121,3 +121,5 @@
 -- #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);

Modified: trunk/raster/test/regress/tickets_expected
===================================================================
--- trunk/raster/test/regress/tickets_expected	2018-10-23 12:19:59 UTC (rev 16939)
+++ trunk/raster/test/regress/tickets_expected	2018-10-23 12:58:02 UTC (rev 16940)
@@ -16,3 +16,4 @@
 NOTICE:  Invalid band index (must use 1-based). Returning NULL
 #4102.1|-10
 #4102.2|-10
+#3457|4950



More information about the postgis-tickets mailing list