[postgis-tickets] [SCM] PostGIS branch master updated. 3.3.0rc2-1008-g84e7fd214
git at osgeo.org
git at osgeo.org
Mon Jun 26 17:41:52 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, master has been updated
via 84e7fd214660e3c70f02c1ed7cf9d9b200df2be1 (commit)
from 4db6905ebed90ece2492a51a6e32beb48d6aab6a (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 84e7fd214660e3c70f02c1ed7cf9d9b200df2be1
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.4.0dev
diff --git a/raster/rt_core/rt_band.c b/raster/rt_core/rt_band.c
index c46ee81f4..66aa19431 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:
raster/rt_core/rt_band.c | 9 +++++----
raster/test/regress/rt_pixelvalue.sql | 14 ++++++++++++++
raster/test/regress/rt_pixelvalue_expected | 2 ++
3 files changed, 21 insertions(+), 4 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list