Mapping Biomes

November 20, 2009

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



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:

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 (see Revolution R blog post)

con <- url("")

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([email protected][[6]]@Polygons[[27]]@coords),Polygon([email protected][[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 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.


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


[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 their blog: Biospherica » R. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, 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.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training


CRC R books series

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)