Download Global Administrative Areas as RData files

Global Administrative Areas (GADM) is a spatial database of the location of the world's administrative areas. Files are provided as Google Earth KMZ, shapefiles (.shp), ESRI geodatabase and as I was exited to see: as .RData files.

Download or load directly from the website.
This will create an object called gadm:

# let's take a small country...
con <- url("") print(load(con)) close(con) [/r] Conveniently, the object turns out to be a SpatialPolygonsDataFrame. [r] str(gadm, max.level=2) Formal class 'SpatialPolygonsDataFrame' [package "sp"] with 5 slots ..@ data :'data.frame': 27 obs. of 16 variables: ..@ polygons :List of 27 ..@ plotOrder : int [1:27] 10 6 24 25 17 22 27 7 13 1 ... ..@ bbox : num [1:2, 1:2] 5.96 45.82 10.49 47.81 .. ..- attr(*, "dimnames")=List of 2 ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots [/r] Add some data (from

language <- c("german", "german", "german", "german","german","german","french","french","german","german","french", "french", "german", "french","german","german","german","german","german","german","german","italian","german","french","french","german","german") gadm$language <- as.factor(language) col = rainbow(length(levels(gadm$language))) spplot(gadm, "language", col.regions=col, main="Swiss Language Regions") [/r] nice!swiss_lang

No TweetBacks yet. (Be the first to Tweet this post)

4 thoughts on “Download Global Administrative Areas as RData files

Comments are closed.