[postgis-users] Pixels' neighbors

dustymugs dustymugs at gmail.com
Tue Jul 2 10:07:51 PDT 2013


Hugues,

You should be able to use ST_MapAlgebraNgb if you have PostGIS 2.0. But
there may be challenges working with neighboring tiles.

PostGIS 2.1 has more robust handling with ST_MapAlgebra.

http://www.postgis.net/docs/manual-2.1/RT_ST_MapAlgebra.html

See the example with the description "Complete example of tiles of a
coverage with neighborhood. This query only works with PostgreSQL 9.1 or
higher.".

-bborie

On 07/02/2013 09:47 AM, Hugues François wrote:
> Hello,
> 
> Given a one band raster made of numerous tiles and a point geometry from which I select one pixel, I would like to compare its value with its (8) neighbors' values. For now I do that with st_value(rast, geom) and playing with point coordinates (x +/- pixel width and y +/- height) : it works fine but it is very slow and I have to make a loop to compare selected pixels' values with their neighbors until I reach a certain value.
> 
> What I would like is to do all that only with raster but I don't see how to compare one pixel value with its neighbors (within the same tile or into a  neighbor tile). I assume I miss something and this is obvious for some of you, so if you could give a hand, i would be sincerely grateful.
> 
> Regards,
> 
> Hugues.
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users
> 


More information about the postgis-users mailing list