[R-sig-Geo] Qgis and R ?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Tue Dec 4 10:00:35 CET 2007


Agustin Lobo wrote:
> Hi!
> 
> Does anyone has experience at displaying spatial R objects
> with QGis (perhaps using the python console + Rpy or RSpython)?
> I'm thinking on starting some testing and would like to know
> about previous experiences.

  I've done a bit of work on this and I think the current best option 
would be to save the R Spatial objects as shapefiles and then load them 
into QGis. For raster data I save as ESRI Ascii Grid format.

  Here's some other ideas:

   * write a data provider for QGis in Python that uses Rpy to fetch the 
data from an R Spatial object stored in a .RData file.

     Advantages: neat and well-integrated

     Disadvantages: tricky. might need some changes to the QGis C++ 
codebase. Only works in QGis.

   * write a GDAL/OGR driver for R Spatial objects.

     Advantages: every project that uses GDAL/OGR can use it. Frank 
Warmerdam would think it's a good idea.

     Disadvantages: would have to be in C++, I'm not sure how to write 
GDAL/OGR drivers that use external libraries (libR.so in this case).

I think writing the GDAL/OGR driver would be the right thing in this 
case, but it would require someone with lots of R and C experience to 
code it up. Start here: http://www.gdal.org/ogr/ogr_drivertut.html

Barry




More information about the R-sig-Geo mailing list