Monthly Archives: January 2011

Nice list of R programming books

There is a lot of information and resources on R. Much can be found online, through the R help mailing list, online tutorials (see e.g. Quick-R) and of course the R website. There are also numerous blogs. For a start you should check out R bloggers, which aggregates content of over 140 blogs about R.

For the beginner, but probably also for the slightly more advanced user, this post on R Why gives an interesting list with R books for undergraduates. Check it out.

R – using string as input in a function

I have a table with sample points from which I need to take subsets based on occurrence of these sample points in certain vegetation types. I have to repeat this many times for different combinations of vegetation types, so I have written a small script that gives me the conditions for sub-setting my table as a string, e.g.,

"VT==1 | VT==3"

But how to convert this string to be used in the subset function? Continue reading

Should you georeference your scientific data?

As Jeff Thurston writes in his blog, a strong case can be made for spatially enabling scientific research. This is especially true for biological / ecological research as biological processes occur across different scales. It certainly would make it that much easier to re-use or complement existing data. Not only would it facilitate collaboration amongst researchers, it would also help ‘end-users’ to find information that is relevant to them. Continue reading

Major conservation biology textbook now free online

Conservation Biology for All, a book edited by Navjot S. Sodhi of the National University of Singapore and Paul R. Ehrlich of Stanford University, has been posted on mongabay.com, an environmental science and conservation news site. Go here to download the book as separate chapters or the whole text: http://news.mongabay.com/2011/0120-free_conservation_book.html

Try out range of geospatial tools the easy way

The main reason I started to use Linux was because at the time it was, and still is I think, much easier and more reliable to run GRASS GIS and other FOSS geospatial tools on Linux. An exception to that is SAGA GIS, which in my experience runs better on Windows (but admittedly I didn’t try out the latest release). People who are thinking about making the same step but are reluctant because of the perceived steep learning curve should consider giving the OSGeo LiveCD from the OSGeo LiveCD project a try Continue reading

Mapping Forest resource assessment 2010 data – part II

I am creating a series of maps based on the Global forest resources assessment 2010 (FRA). A first example is the map below with the forest and woodland cover per country as percentage of the total land area. The pie charts show the proportion of the forest-woodland area covered by forest and the portion covered by woodland per country. There are obviously other, and possible better, ways to present this information, but I wanted to try out and demonstrate the use of chart overlay in QGIS. Continue reading

Finding and removing carriage returns in your SQLite table

The problem with copy data from e.g., an excel or calc sheet into an SQLite database (or any database I reckon) is that the data you copy might include an carriage return. I found this out the hard way after having copied data from a spreadsheet into a attribute table of a GRASS GIS vector layer (which is stored in a SQLite database). Continue reading

Mapping Forest resource assessment 2010 data – part I

About a year ago I wrote a post about how to make a map showing deforestation rates in Africa based on the Global Forest Assessment 2005 by the Food and Agriculture Organization of the United Nation (FAO). The main purpose was to show how this could be done in R. It has since become the most viewed post on my blog, mostly by people looking for maps on deforestation or forest cover in Africa.

Autumn last year the new Global forest resources assessment 2010 (FRA) has been published by the FAO. Time for an update Continue reading

Getting action into your layer

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).

Creating high resolution geo-referenced maps

Just making a note to myself for when I want to make a high resolution geo-referenced map composed of different input data layers. As described here, one can save an image of the current map(s) in QGIS, but the image will have a fairly low resolution (it is basically a screen shot). You can create very nice maps with the ‘print composer’, but then it will not be geo-referenced.

A solution is to use the QGIS command line to create a snapshot of a map. This way, you can create images of any size and with corresponding world file. See http://underdark.wordpress.com/2010/11/30/creating-high-resolution-images-using-qgis/ for a step by step description how to do this.