[R-sig-Geo] Slope and Aspect calculations in R

Roger Bivand Roger.Bivand at nhh.no
Thu Jul 9 22:59:15 CEST 2009


On Thu, 9 Jul 2009, Josh London wrote:

> Thanks for the suggestions so far regarding the use of GRASS or SAGA.
>
> We have considered those options but SAGA doesn't appear available for MacOS. 
> My understanding is that spgrass6 is more for accessing R code/functions from 
> within GRASS vs accessing GRASS functions from within R. We have all our 
> other analysis coded up in R, and just need these functions to do one part of 
> a bigger process. Maybe I'm misunderstanding how to use R and GRASS together. 
> I'll do some further research.

>From 0.6-* on CRAN, you can create an anonymous GRASS location on the fly 
with initGRASS() and run GRASS commands like r.slope.aspect with 
execGRASS() from the R side. See http://www.geomorphometry.org/R.asp for 
some examples - foot of page. You may also want to look at the underlying 
literature, and some of the functionality being provided in the raster 
package on R-Forge.

Roger

>
> Thanks again
> Josh
>
> Josh London wrote:
>> Hello
>> 
>> We are looking to mimic, in R, the slope (max magnitude difference between 
>> a cell and its neighbors) and aspect (direction of maximum magnitude 
>> difference) functions found in ESRI's Spatial Analyst package. We were just 
>> about to code up the slope function but thought I would make sure we 
>> weren't re-inventing any wheels already out there.
>> 
>> Thanks
>> Josh
>> 
>
>

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list