[R-sig-Geo] Load R sp vector layers in QGIS

Paul Hiemstra p.hiemstra at geo.uu.nl
Thu Jun 19 15:23:51 CEST 2008


Hi Carson,

Is exporting the Spatial object to a .shp (or other vector format) and 
then reading the file in to QGIS not an easier way to get R spatial 
layers into QGIS. That also solves the problem of not being able to edit 
the features. If you edit in QGIS and save you can read the file back 
into R.

R is also capable of displaying GIS information quite nicely (spplot). I 
tried several programs under Linux to create map output (QGIS, udig,  
for journal articles and ended up using R. R certainly has a steeper 
learning curve, but the output from the version of QGIS I used (0.9.2) 
was not good enough for me.

So my question is, what is the big advantage of getting R data into QGIS 
in this way.

cheers,
Paul

cfarmer wrote:
> Hello lists,
>
> Apologies for cross posting, but I thought this might be of interest to
> all groups...
>
> Thanks to the excellent work of Martin Dobias on the QgsMemoryProvider, I
> have created a simple plugin which acts as an additional file type handler
> for R sp vector objects in QGIS.
>
> To use:
> 1) In R ( or manageR ;) ), create an sp vector object
> (SpatialPointsDataFrame, SpatialPolygonsDataFrame, SpatialLinesDataFrame).
> 2) Save the sp object to a .Rdata file
> 3) Enable the plugin in QGIS (the button should appear in the file toolbar
> along with 'add vector layer', 'add raster layer', etc..
> 4) Click 'loadRlayer' button, and browse to your .Rdata file
> 5) The plugin should do the rest, and voila! Your R spatial layer should
> be displayed on the QGIS map canvas.
>
> To get it:
> 1) It is available from: 'http://www.geog.uvic.ca/spar/carson/'
> or
> 2) Add 'http://www.geog.uvic.ca/spar/carson/cfarmerQgisRepo.xml' to your
> repositories list in QGIS
>
> Notes:
> 1) When possible, the spatial reference information is taken from the sp
> object
> 2) The name is also taken from the sp object, not the name of the .Rdata file
> 3) Your .Rdata file should only contain a single sp object
> 4) I haven't tested this on multipoint or multiline features...?
> 5) You should be able to do all the normal things that vector layers in
> QGIS can do (except for save edits).
> 6) Note that at this point, changes to the layer in QGIS will not be
> reflected in the initial sp object, thus, this plugin is primarily for
> visualizing your sp vector objects.
>
> Hope you enjoy!
>
> Carson
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: 	+31302535773
Fax:	+31302531145
http://intamap.geo.uu.nl/~paul




More information about the R-sig-Geo mailing list