[postgis-tickets] [PostGIS] #5410: ST_Value throws an error "ERROR: rt_band_get_nodata: Band has no NODATA value" if bilinear is chosen as a sampling option

PostGIS trac at osgeo.org
Sun Jun 25 11:59:48 PDT 2023


#5410: ST_Value throws an error "ERROR:  rt_band_get_nodata: Band has no NODATA
value" if bilinear is chosen as a sampling option
--------------------+---------------------------
 Reporter:  robe    |      Owner:  robe
     Type:  defect  |     Status:  new
 Priority:  medium  |  Milestone:  PostGIS 3.2.6
Component:  raster  |    Version:  3.2.x
 Keywords:          |
--------------------+---------------------------
 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.
-- 
Ticket URL: <https://trac.osgeo.org/postgis/ticket/5410>
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