[postgis-tickets] [SCM] PostGIS branch stable-3.2 updated. 3.2.5-6-gb8bdce607

git at osgeo.org git at osgeo.org
Mon Jun 26 19:44:54 PDT 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, stable-3.2 has been updated
       via  b8bdce6072e78c4c829530e8d8e6385a4b02ad22 (commit)
      from  c30b5f4f591cc87543b199c2d79f82b90233c25a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b8bdce6072e78c4c829530e8d8e6385a4b02ad22
Author: Regina Obe <lr at pcorp.us>
Date:   Mon Jun 26 20:31:40 2023 -0400

    ST_Value bilinear
    
     - Don't throw an error if nodatavalue, instead use 0
     - Add tests for bilinear
    
     Closes #5410 for PostGIS 3.2.6

diff --git a/NEWS b/NEWS
index 69d5f69d7..d659a04b4 100644
--- a/NEWS
+++ b/NEWS
@@ -7,8 +7,11 @@ Additional features are enabled if you are running GEOS 3.9+
 Proj 6.1+, and PostgreSQL 14+.
 
 * Bug Fixes and Enhancements *
-  - #5403, Fix ValidateTopology(bbox) without topology in search_path
-           (Sandro Santilli).
+  - #5403, [postgis_topology] Fix ValidateTopology(bbox)
+           without topology in search_path (Sandro Santilli)
+  - #5410, [postgis_raster] ST_Value bilinear resample,
+           don't throw an error if Band has no NODATA value
+           (Regina Obe)
 
 
 PostGIS 3.2.5
diff --git a/raster/rt_core/rt_band.c b/raster/rt_core/rt_band.c
index fb6e65676..584a055a9 100644
--- a/raster/rt_core/rt_band.c
+++ b/raster/rt_core/rt_band.c
@@ -1262,7 +1262,6 @@ rt_band_get_pixel_bilinear(
 	double xr, double yr,
 	double *r_value, int *r_nodata)
 {
-	rt_errorstate err;
 	double xcenter, ycenter;
 	double values[2][2];
 	double nodatavalue = 0.0;
@@ -1294,9 +1293,11 @@ rt_band_get_pixel_bilinear(
 	xdir = xr < xcenter ? 1 : 0;
 	ydir = yr < ycenter ? 1 : 0;
 
-	err = rt_band_get_nodata(band, &nodatavalue);
-	if (err != ES_NONE) {
-		nodatavalue = 0.0;
+	if (rt_band_get_hasnodata_flag(band) != FALSE) {
+			rt_band_get_nodata(band, &nodatavalue);
+	}
+	else {
+			nodatavalue = 0.0;
 	}
 
 	/* Read the 2x2 values from the band */
diff --git a/raster/test/regress/rt_pixelvalue.sql b/raster/test/regress/rt_pixelvalue.sql
index fb9c05341..942c1e889 100644
--- a/raster/test/regress/rt_pixelvalue.sql
+++ b/raster/test/regress/rt_pixelvalue.sql
@@ -288,6 +288,8 @@ SELECT 'test 1.10', id
 
 -----------------------------------------------------------------------
 -- Test 2 - st_value(rast raster, band integer, pt geometry)
+--        - st_value(rast raster, band integer, pt geometry,
+--                   boolean exclude_nodata_value=true, text resample)
 -----------------------------------------------------------------------
 
 SELECT 'test 2.1', id
@@ -298,6 +300,18 @@ SELECT 'test 2.2', id
     FROM rt_band_properties_test
     WHERE st_value(rast, 2, st_makepoint(st_upperleftx(rast), st_upperlefty(rast))) != b2val;
 
+SELECT 'test 2.3', id, st_value(rast, 1,
+	ST_Centroid(rast::geometry),
+		 true, 'bilinear') AS val
+    FROM rt_band_properties_test
+    WHERE id = 1;
+
+SELECT '#5410', id, st_value(
+		ST_SetBandNoDataValue(rast,1,NULL), 1,
+		ST_Centroid(rast::geometry),
+		 true, 'bilinear') As val
+	FROM rt_band_properties_test
+	WHERE id = 1;
 -----------------------------------------------------------------------
 -- Test 3 - st_pixelaspolygon(rast raster, x integer, y integer)
 -----------------------------------------------------------------------
diff --git a/raster/test/regress/rt_pixelvalue_expected b/raster/test/regress/rt_pixelvalue_expected
index 49194c799..7576caaff 100644
--- a/raster/test/regress/rt_pixelvalue_expected
+++ b/raster/test/regress/rt_pixelvalue_expected
@@ -4,6 +4,8 @@ NOTICE:  Attempting to get pixel value with out of range raster coordinates: (-2
 NOTICE:  Attempting to get pixel value with out of range raster coordinates: (-2, -2)
 ERROR:  Raster and geometry do not have the same SRID
 ERROR:  Raster and geometry do not have the same SRID
+test 2.3|1|2
+#5410|1|2
 NOTICE:  Raster do not have a nodata value defined. Set band nodata value first. Nodata value not set. Returning original raster
 NOTICE:  Raster do not have a nodata value defined. Set band nodata value first. Nodata value not set. Returning original raster
 NOTICE:  Raster do not have a nodata value defined. Set band nodata value first. Nodata value not set. Returning original raster

-----------------------------------------------------------------------

Summary of changes:
 NEWS                                       |  7 +++++--
 raster/rt_core/rt_band.c                   |  9 +++++----
 raster/test/regress/rt_pixelvalue.sql      | 14 ++++++++++++++
 raster/test/regress/rt_pixelvalue_expected |  2 ++
 4 files changed, 26 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list