[postgis-devel] [PostGIS] #1751: [raster] ST_NearestValue

PostGIS trac at osgeo.org
Tue Apr 3 12:16:35 PDT 2012


#1751: [raster] ST_NearestValue
-------------------------+--------------------------------------------------
 Reporter:  dustymugs    |       Owner:  dustymugs     
     Type:  enhancement  |      Status:  new           
 Priority:  medium       |   Milestone:  PostGIS Future
Component:  raster       |     Version:  trunk         
 Keywords:               |  
-------------------------+--------------------------------------------------
 When sticking a pin through a tile to get a value, it may be that the
 pixel at that pin is NODATA.  One possible solution is to do a buffer
 around the pin and then aggregate the values in that buffer (assuming that
 buffer contains any actual values).  This solution works but is slow due
 to the intermediate generation of raster resulting from the intersection
 of the buffer and the tile, whose values then get aggregated.

 Instead, a simpler solution is to take the point and find the nearest
 pixel to it and return that pixel's value.  Additionally, it is pointless
 to call ST_Value and then ST_NearestValue when ST_Value returns NULL
 (NODATA), so ST_NearestValue will return ST_Value's value if the point is
 on a pixel with value.

 ST_NearestValue() must match the signatures of ST_Value as it is a drop-in
 replacement for it.

 ST_NearestValue(rast raster, band integer, pt geometry,
 exclude_nodata_value boolean DEFAULT TRUE)

 ST_NearestValue(rast raster, pt geometry, exclude_nodata_value boolean
 DEFAULT TRUE)

 ST_NearestValue(rast raster, band integer, x integer, y integer,
 exclude_nodata_value boolean DEFAULT TRUE)

 ST_NearestValue(rast raster, x integer, y integer, exclude_nodata_value
 boolean DEFAULT TRUE)

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1751>
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-devel mailing list