Skip to content

Gradient calculation with ESRI grid (.asc) format

2 messages · Tim Sippel, Robert J. Hijmans

#
You could try the focalFilter function in the raster package:
install.packages("raster", repos="http://R-Forge.R-project.org")

with this argument for the Sobel filter:
filter=matrix(c(1,2,1,0,0,0,-1,-2,-1) / 4, nrow=3)

(For using raster this way you should upgrade to R 2.9 first, if you
have not done so yet; otherwise you will get an old version; this is
an unpleasant feature of R-forge)

Robert
On Wed, May 6, 2009 at 11:15 AM, Tim Sippel <tsippel at gmail.com> wrote: