Saturday, 30 September 2017

Is it possible to run an R script on a layer in QGIS?


I'd like to run an R script on a layer loaded in QGIS (to rotate a set of points created there using the Vector:Research Tools:Regular Points tool). I thought ManageR might work but cannot get it working on OSX ...


Of course, I could do it manually (create layer -> run script from within R -> find output and reload into QGIS) but surely there is a more elegant solution?




Answer



It is possible to get manageR working on OSX (Lion 10.7.2) at least.


It looks like the problem with manageR / rpy2 was actually problems with the previous R builds (2.13 at least) - symlinks were referring to the wrong location.



  1. Update R to 2.14 (binary from r-project.org);

  2. Reinstall QGIS (Kyngchaos installer);

  3. Reinstall GDAL_complete (Kyngchaos again);

  4. Reinstall rpy2 (latter via pip), rebooted ...


... and manageR now loads and works. Haven't tried this in Linux yet.



UPDATE: The SEXTANTE plugin can be used to write scripts that call R, with some modifications in OSX to make it work properly.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...