[PostGIS] #5649: Since introduction of resampling on ST_Value (v3.2) behaviour on inexisting band has changed
PostGIS
trac at osgeo.org
Wed Dec 20 09:03:11 PST 2023
#5649: Since introduction of resampling on ST_Value (v3.2) behaviour on inexisting
band has changed
---------------------+---------------------------
Reporter: lieven | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 3.2.7
Component: postgis | Version: 3.4.x
Keywords: |
---------------------+---------------------------
Hello,
Regarding the changes made since version 3.2 of PostGIS, the behavior of
ST_Value with geometry points now utilizes "RASTER_getPixelValueResample".
However, there have been alterations in the behavior when dealing with
non-existing bands.
Here's my query:
{{{
WITH poi AS (
SELECT ST_SetSRID(ST_Point(1.75, 46.37), 4326) AS coord
)
SELECT
rast.time,
ST_Value(rast, 1, coord) AS u_wind,
ST_Value(rast, 2, coord) AS v_wind,
ST_Value(rast, 3, coord) AS temperature,
ST_Value(rast, 4, coord) AS humidity,
ST_Value(rast, 5, coord) AS pressure,
ST_Value(rast, 6, coord) AS cloud_cover,
ST_Value(rast, 7, coord) AS precipitations,
ST_Value(rast, 8, coord) AS ww,
rast.model
FROM poi
LEFT JOIN weather.inspire_2023_12_raster_4326 rast ON (ST_Intersects(rast,
coord))
WHERE time = TIMESTAMP WITHOUT TIME ZONE '2023-12-20 00:00:00';
}}}
Regarding the bands 6, 7, etc., potentially being empty, there's a change
in behavior from prior versions where the function used to return the
first band's value and set null for others. However, since version 3.2, an
error message occurs and I have no result at all:
{{{
"ERROR: Could not find raster band of index 6 when getting pixel value.
Returning NULL SQL state: XX000"
}}}
This change in behavior seems to be associated with the new method
"RASTER_getPixelValueResample" utilized with geometry, whereas using
raster coordinates with version > 3.2 employs "RASTER_getPixelValue",
maintaining the previous version's functionality without exceptions.
The main issue here is that the behavior changes depending on the
parameters
With this constraint I'm currently stuck with version < 3.2
In all cases, thank you for your amazing job with PostGis
--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5649>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-tickets
mailing list