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

Josh London josh.london at noaa.gov
Fri Jul 10 20:42:29 CEST 2009


Thanks to everyone for the feedback. I may dabble around with SAGA/RSAGA 
on a linux box we have and also continue to watch for any MacOS builds.

Roger, I am especially excited that spgrass6 has the initGRASS() 
function. by providing access to r.slope.aspect, I think that will be 
the simplest/quickest route to a solution. I look forward to tapping 
into other GRASS commands in the future. You may want to consider 
changing the description of spgrass6 on CRAN. I have interpreted the 
phrase 'based on starting R from within the GRASS environment' to mean 
the package is for those who use GRASS and want to access functions 
within R.

cheers, and thanks again for the feedback and help

Josh

Tomislav Hengl wrote:
> Yes: SAGA runs normally on Linux (I use it also), but you can not use the command line from R (i.e.
> RSAGA) to pass command to SAGA  :(
> 
> But you can use R to pass command lines to SAGA without RSAGA (i.e. the batch files):
> 
> http://saga-gis.wiki.sourceforge.net/Executing+Modules+with+SAGA+CMD 
> 
> Tom Hengl
> http://spatial-analyst.net 
> 
> 
>> -----Original Message-----
>> From: Thomas Adams [mailto:Thomas.Adams at noaa.gov]
>> Sent: Friday, July 10, 2009 4:20 PM
>> To: Tomislav Hengl
>> Cc: r-sig-geo at stat.math.ethz.ch
>> Subject: Re: [R-sig-Geo] Slope and Aspect calculations in R
>>
>> Tom,
>>
>> Thanks! I have seen your posts and results of some of your work with
>> SAGA and I am very interested. But, I have been to lazy to this point to
>> try compiling SAGA for either MacOS X or Linux (is a Linux distribution
>> available?).
>>
>> Regards,
>> Tom
>>
>> Tomislav Hengl wrote:
>>> Dear Josh, Thomas,
>>>
>>> I typically use R+SAGA (R on top!) for such type of analysis (and I do have access to all
>> operating
>>> system/software). There must be some good reasons that I am using SAGA (speed, stability, rich
>>> geomorphometry module etc.)! So do not give up so easy on SAGA.
>>>
>>> I especially like that SAGA is fairly efficient in processing big grids, and the commands are
>> rather
>>> compact. For example to reproject grids from one to another proj4string, you only need to set
>> e.g.:
>>>
>>>> rsaga.geoprocessor(lib="pj_proj4", 2, param=list(SOURCE_PROJ=paste('"', proj4string(dem25m),
>> '"',
>>> sep=""), TARGET_PROJ="\"+proj=longlat +datum=WGS84\"", SOURCE="TWI.sgrd", TARGET="TWI_ll.sgrd",
>>> TARGET_TYPE=0, INTERPOLATION=0))
>>>
>>> *see http://www.geomorphometry.org/R.asp
>>>
>>> I remember that somebody did manage to set-up SAGA also under Mac OS
>>> (http://www.saga-gis.uni-goettingen.de/html/index.php?module=pnForum&func=viewtopic&topic=458),
>> but
>>> I also remember that most of students on our GEOSTAT course used Windows under Mac OS to run
>> SAGA. I
>>> am sure that it should be possible to compile SAGA under Mac OS, but somebody needs to put some
>>> effort to bridge this gap (check also with Olaf Conrad).
>>>
>>> Here is more discussion about the same topic from few months ago:
>>> https://stat.ethz.ch/pipermail/r-sig-geo/2009-April/005418.html
>>>
>>> cheers,
>>>
>>> Tom Hengl
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: r-sig-geo-bounces at stat.math.ethz.ch [mailto:r-sig-geo-bounces at stat.math.ethz.ch] On
>> Behalf
>>>> Of Thomas Adams
>>>> Sent: Friday, July 10, 2009 3:12 PM
>>>> To: Josh London
>>>> Cc: r-sig-geo at stat.math.ethz.ch
>>>> Subject: Re: [R-sig-Geo] Slope and Aspect calculations in R
>>>>
>>>> Josh,
>>>>
>>>> I use R & GRASS together on both MacOS X and Linux without problems.
>>>> It's very direct to write a shell script that calls both R & GRASS
>>>> within a single script. Writing a R script that calls GRASS may be more
>>>> tedious to do what you want. Writing a shell script that calls both may
>>>> be the wat to go.
>>>>
>>>> Tom
>>>>
>>>> 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.
>>>>>
>>>>> 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
>>>>>>
>>>>>>
>>>> --
>>>> Thomas E Adams
>>>> National Weather Service
>>>> Ohio River Forecast Center
>>>> 1901 South State Route 134
>>>> Wilmington, OH 45177
>>>>
>>>> EMAIL:	thomas.adams at noaa.gov
>>>>
>>>> VOICE:	937-383-0528
>>>> FAX:	937-383-0033
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo at stat.math.ethz.ch
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>
>>> _______________________________________________
>>> R-sig-Geo mailing list
>>> R-sig-Geo at stat.math.ethz.ch
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>
>>
>> --
>> Thomas E Adams
>> National Weather Service
>> Ohio River Forecast Center
>> 1901 South State Route 134
>> Wilmington, OH 45177
>>
>> EMAIL:	thomas.adams at noaa.gov
>>
>> VOICE:	937-383-0528
>> FAX:	937-383-0033
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Josh M. London, PhD

Wildlife Biologist
Polar Ecosystem Program
National Marine Mammal Lab
Alaska Fisheries Science Center, NOAA Fisheries
Seattle, WA

The contents of this message are mine personally and do not
necessarily reflect any position of the Government or the
National Oceanic and Atmospheric Administration.



More information about the R-sig-Geo mailing list