[R-sig-Geo] Making GIS and R play nicely - some tips?

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 2 16:12:11 CET 2005


On Wed, 2 Mar 2005, abunn wrote:

> Hi R Spatial People:
> 
> I am an experienced R user and an experienced GIS user - however, that GIS
> is Arc. In the past when I've worked with spatial data in R, I've done so by
> exporting the GIS data (always grids) from Arc as ASCII files. Then I read
> them into R and go through some gymnastics to dump the no data values
> (-9999) while I do my analysis (say a regression tree) and then write the
> ASCII back out and suck it into Arc for display. This lose coupling seems
> inelegant.
> 
> I'm starting on a new project where I have a time series of about 250 grids
> that are roughly 1000 by 1000. There is a response variable and up to six or
> so predictors. So, it's enough data that I feel it's time to learn how to do
> it right. Question is, what's right?
> 
> Is the state of the art approach to use GRASS a la Bivand and Neteler's
> paper (http://agec144.agecon.uiuc.edu/csiss/Rgeo/)? Is it better to dump the
> grids to an imagine file (or bil) and read them with rgdal? I work mostly in
> Windows (b/c of ESRI - damn them!) but switch gears onto Linux when the task
> requires it. I have never used GRASS. Show me the way!
> 

Well, there are plenty of possibilities. The first question (abstracting 
from the size of the data) is whether to go the way suggested in:

http://www.gisvet.org/Documents/GisVet04/RegularPapers/Tait.pdf

which leaves Arc in front, using R just as the compute engine, and passing 
data through StatConnector. I don't think that the code used has been 
published, but a very simple VBA example is at:

http://perso.univ-lr.fr/csaintje/Recherche/RArcgis/index.html

That permits the Arc user to avoid knowing about R if you need later to 
package the procedure for others to use. My guess is that this hasn't been 
checked on ArcGIS 9 (I'll try to check soon).

Another is as you suggest to use the rgdal package to move the data into 
R, and once we get rgdal better checked for writing, back out too. That 
puts R in front of the loose-coupled data.

A third is to use GRASS 5.4 and the R GRASS interface package, which reads 
and writes GRASS raster layers; GRASS can read from many formats and to 
many formats, and can run (as can the interface) under cygwin. This runs 
R on top of GRASS, which can be accessed through system(). The state 
of the art is certainly M. Neteler, H. Mitasova, 2004. Open Source GIS: A 
GRASS GIS Approach. Second Edition. 424 pages, Kluwer Academic Publishers, 
Boston, Dordrecht, ISBN 1-4020-8064-6 (Also published as eBook, ISBN 
1-4020-8065-4), chapter 13. You might also enjoy: 

http://www.ci.tuwien.ac.at/Conferences/DSC-2003/Proceedings/FurlanelloEtAl.pdf

showing GRASS, R and PostgreSQL working together.

But isn't the real challenge going to be shoehorning 250 by 1000 by 1000 
by 8 into R at once - or are the data layers needed just one after the 
other? If I could grasp the workflow better, the advice above could become 
more focussed, I think.

Best wishes,

Roger

> Thanks in advance, Andy
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 

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




More information about the R-sig-Geo mailing list