Mapping Biomes

November 20, 2009
By

(This article was first published on Biospherica » R, and kindly contributed to R-bloggers)

Recently (2008) the European Space Agency produced GlobCover (ESA GlobCover Project, led by MEDIAS-France), the highest resolution (300m) global land cover map to date. GlobCover uses 21 primary land cover classes and many more sub-classes. Land cover classification (LCC) schemes divide the earth into biomes. Biomes are the simplest way to classify vegetation which can be applied globally. LCC makes sense because the boundaries between different ecosystems (ecotones) are sharp. However, definitions vary and there is no agreed standard set of biomes.[1]

GlobCover Example

Puntarenas is a province on the pacific coast of Costa Rica.  The province has a typical mix of tropical land cover. This includes some spectacular examples of Pacific Rainforest, notably on the Osa Peninsula. Puntarenas has an area of ≈ 11,000 sq. km or about 120,000 GlobCover pixels.

13 land cover types are present in the GlobCover map below. The barplot on the right shows the total amounts present in each class.

puntarenas

legend

The GlobCover legend (above) has mixed land cover classes, where more than one biome occurs  inside a map pixel. This is especially true in the man-made biomes (agriculture) . For example, there are three cropland land cover types depending on the relative amounts of other vegetation present.

GlobCover map making in R

R is a programming language, not a specialised geographic information system (GIS) such as GRASS or commercial packages. However applications of R to spatial problems is a growth industry.[2]

A GlobCover map similar to the above can be produced for any area of interest. The Geospatial Data Abstraction Library (GDAL) should be installed on your system. FWTools is the place to go. You also need R packages sp and rgdal installed. The regional GLOBCOVER map for Central America can be downloaded from ESA here. GlobCover is in GeoTiff format i.e. a Tiff image file which contains georeferencing information. The following GDAL command (from command line, or run from R using shell) creates a 4° x 4° submap centred on Costa Rica.

gdalwarp GLOBCOVER_200412_200606_V2.2_CentralAmerica_Reg.tif -te -86 8 -82 12 costaRica.tif

costaRica.tif is read into R using the rgdal package:

library(rgdal)
costa <- readGDAL("costaRica.tif")

costa has class SpatialGridDataFrame, which is a class defined in the package sp (loaded when rgdal is loaded).

Administative boundaries for Costa Rica were obtained from Global Administrative Areas www.gadm.org (see Revolution R blog post)

con <- url("http://gadm.org/data/rda/CRI_adm1.RData")
load(con)
close(con)

Costa Rican provinces are now contained in the object gadm of class SpatialPolygonsDataFrame. The boundaries of Puntarenas province (excluding Cocos Island) are extracted as follows:

Polygons(list(Polygon(gadm@polygons[[6]]@Polygons[[27]]@coords),Polygon(gadm@polygons[[6]]@Polygons[[25]]@coords)),"puntarenas")
temp <- SpatialPolygons(list(temp),proj4string=CRS(proj4string(gadm)))
punt.sp <- SpatialPolygonsDataFrame(temp, data.frame(cbind(2,2), row.names=c("puntarenas")))  # puntarenas

The overlay() method  is used to extract the land cover map puntarenas from costa:

puntarenas <- costa
puntarenas.overlay <- overlay(costa,punt.sp)  # 1 in interior of puntarenas polygons, 0 outside
puntarenas$band1 <- costa$band1*puntarenas.overlay

Unfortunately overlay() is rather slow, because it applies point.in.polygon() to the entire raster. Eventually puntarenas appears as a SpatialGridDataFrame which can be plotted using standard R tools such as image().

The code needed to generate the above plot is here.

footnotes

[1] For example, the International Biosphere-Geosphere Programme (IGBP) land cover legend used 17 biomes. The University of Maryland map used 14 biomes. At much lower resolution, numerical weather forecasting models such as US National Center for Climate Prediction Global Forecasting System (NCEP-GFS) also use alternative schemes.

LCTable

[2] Roger S. Bivand, Edzer J. Pebesma, and Virgilio Gómez-Rubio. Applied Spatial Data Analysis with R. Springer, New York, 2008

To leave a comment for the author, please follow the link and comment on his blog: Biospherica » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.