[postgis-users] raster operations

David Haynes haynesd2 at gmail.com
Wed Jun 13 09:56:29 PDT 2018


 I have a question about how to focal operations for raster statistics are
working. I started off comparing the old depreciated
function st_mapalgebrafctngb with the current version st_mapalgebra. The
difference I have determined is that the st_mapalgebrafctngb will pass the
call back function to the raster dataset similar to the st_mapalgebra, but
as the function approaches the edge of the raster tile things get wonky.
What are values that are assigned to pixels that do not have sufficient
neighbors? When I run this bit of code. The ST_Value function reports that
no values have been assigned. I assume this can be remedied by adding
information through userargs.

with smoothed_raster as
(
SELECT st_mapalgebrafctngb(rast, 1, NULL, 1, 1, 'st_mean4ma(double
precision[][][],text,text[])'::regprocedure, 'ignore', NULL) as rast
FROM glc2000_clipped_250 r
WHERE r.rid = 25
), original_raster as
(
SELECT r.rast
FROM glc2000_clipped_250 r
WHERE r.rid = 25
)
SELECT x, y, ST_Value(s.rast, x,y) as smoothed, ST_Value(o.rast, x,y) as
original
FROM smoothed_raster s, original_raster o
CROSS JOIN generate_series(1,10) as x
CROSS JOIN generate_series(1,10) as y

This leads me to a larger question regarding focal analysis functions for
raster datasets. Do these functions cross the tiles? Assume you have 9
tiles and each tile is composed of 3x3 pixels. Tiles 1-3 in row 1, 4-6 row
2 etc. If you have a neighborhood analysis function performing on tile 5.
Will it grab adjacent pixels in tile 6? Unfortunately the examples I
created returned with the same result.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20180613/336cb6c4/attachment.html>


More information about the postgis-users mailing list