Opened 17 months ago
Closed 17 months ago
#5410 closed defect (fixed)
ST_Value throws an error "ERROR: rt_band_get_nodata: Band has no NODATA value" if bilinear is chosen as a sampling option
Reported by: | robe | Owned by: | robe |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 3.2.6 |
Component: | raster | Version: | 3.2.x |
Keywords: | Cc: |
Description
This was noted in IRC by JohnSmit99
Below from IRC notes
this works: ```select ST_Value(rast, ST_SetSRID(ST_MakePoint(20,20), 4326)) as val from mytable WHERE ST_Intersects(rast, ST_SetSRID(ST_MakePoint(20, 20), 4326)) AND timestamp = '2016-01-10 12:00:00';``` 12:22PM this does NOT work: ```select ST_Value(rast, 1, ST_SetSRID(ST_MakePoint(20,20), 4326), true, 'bilinear') as val from mytable WHERE ST_Intersects(rast, ST_SetSRID(ST_MakePoint(20, 20), 4326)) AND timestamp = '2016-01-10 12:00:00'; 12:22PM ERROR: rt_band_get_nodata: Band has no NODATA value``` 12:23PM the band indeed has no NODATA value, but I don't see how this should make the command fail 12:23PM POSTGIS="3.3.2 0" [EXTENSION] PGSQL="150" GEOS="3.11.1-CAPI-1.17.1" PROJ="9.1.0" GDAL="GDAL 3.5.3, released 2022/10/21" LIBXML="2.10.4" LIBJSON="0.16" LIBPROTOBUF="1.4.1" WAGYU="0.5.0 (Internal)" TOPOLOGY RASTER
The issue I think is https://git.osgeo.org/gitea/postgis/postgis/src/branch/master/raster/rt_core/rt_band.c#L1297 #in the rt_band_get_pixel_bilinear function
The rt_band_get_nodata exits the whole process. I think band→hasnodata has to be checked first before calling rt_band_get_nodata or alternatively change rt_band_get_nodata to use
rtwarn instead of rterror when erroring out.
Changing rt_band_get_nodata makes more sense to me, but not sure the ramifications of that as this function is used all over the place.
Change History (5)
comment:1 by , 17 months ago
comment:3 by , 17 months ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Oops didn't mean to close until I backported to 3.3 and 3.2
It's safer not to change the existing function but rather do the pre-check