User Tools

Site Tools


Sidebar

Translations of this page:

Back to BIS-Schools

Biodiversity data analysis with R

Lectures

Worksheets

Code

Excursus

en:learning:schools:s01:worksheets:ba-ws-10-1

W10-1 GIS data I/O and some visualizations

This worksheet provides a first impression on how to handle GIS data sets in R. After completing this worksheet you should know how to read ESRI shape files and GeoTiff raster data sets and visualize them in a simple plot.

Things you need for this worksheet

  • R — the interpreter can be installed on any operation system. For Linux, you should use the r-cran packages supplied for your Linux distribution. If you use Ubuntu, this is one of many starting points. If you use windows, you could install R from the official CRAN web page.

  • R Studio — we recommend to use R Studio for (interactive) programming with R. You can download R Studio from the official web page.

  • Field survey 2014 subset 01 as shape data set - a subset of the 2014 field survey data set as ESRI shape data set can be downloaded from here.

  • Fogo DEM and NDVI - a digital elevation model derived from SRTM observations and a Landsat based NDVI from 2013 can be downloaded from here.

Learning log assignments

:!: Please open a new script and name it “W10-1.R”.

For this worksheet we will need the packages “rgdal”, “raster” and “plotKML”. Please load them (peek at W04-1 if you forgot how to load libraries or install packages).

So far we have worked on a CSV version of the data subset from the field survey of 2014. In this worksheet, we will use the same data but this time it is provided as an ESRI shape data set. Hence, in addition to the information we got already from the CSV version, we now have a location information about the plots.

:-\ Please read the ESRI shape file version of he field survey data subset. Instead of read.table(), please use readOGR(). Have a look at the meta data of this shape file using the print() function once you have loaded it into memory. Check out what is happening if you use the plot() function instead.

:-\ To make things a little more interesting, please load the two raster data sets (NDVI and DEM) by simply supplying the file names to the raster() function. Have a look at the meta information of the variables you have used to store the two data sets.

Let's combine one of the raster data sets and your field survey plots into one map type figure.

:-\ Please plot the NDVI image using the plot() function and add your ESRI shape content to the plot by calling the plot() function once again, this time supplying the shape variable and the attribute “add =TRUE”.

:-\ The result might look good but it's so … small! Unless one of your ancestors was an eagle you won't be able to identify anything. So let's zoom in a bit using the zoom() function and combine it again with our plots.

:-\ Enough of that normal stuff. Let's do some fancy plotting of the locations where the vegetation coverage has been recorded in Google Earth by supplying the vegetation coverage attribute of the shape data set to the plotKML() function.

en/learning/schools/s01/worksheets/ba-ws-10-1.txt · Last modified: 2015/09/22 16:22 (external edit)