I often run R from within GRASS GIS. For example using R as a scripting language to automate GIS analysis. Or to use statistical models in R on spatial data in GRASS.
I used to open R in the terminal. However, I am using more and more RStudio instead. This has one drawback. When opening RStudio in the terminal (or any other program for that matter), you cannot use that command prompt anymore. Continue reading
QGIS provides the option to perform an action based on the attributes of a feature. This is useful if you want to run an external application or view a web page based on one or more values in your vector layer. How to define and run an action is explained in the user guide (http://download.osgeo.org/qgis/doc/manual/qgis-1.6.0_user_guide_en.pdf), check the section on ‘Action tab’.
I needed this feature to extract information from a vegetation map for Tanzania I am working on. The layer has fields for the vegetation type and an unique ID. I want list both the ID and name of the vegetation type for a number of polygons and export them to a text file. Following the user guide I tried:
bash -c "echo \"%cat %PNVs2\" >> /home/paulo/output.txt"
Unfortunately nothing was written to the file ‘output.txt’. After trying different options, I found out that the following syntax does work.
bash -c "echo '%cat %PNVs2' >> /home/paulo/output.txt"
I am not terribly familiar with bash syntax (OK, make that a not at all), but it seems things might work slightly different depending on the system you are working on (I am for example working on Ubuntu).
R includes some powerful yet easy to use functions that provide a direct interface to the computer’s file system. In the example below I use two of these functions (file.info and file.copy) to copy a random selection of the songs on my computer to my mp3 player, while making sure that the combined size of these files does not exceed 500MB. Continue reading