Provincial Map using GADM

August 5, 2012

(This article was first published on Data Analysis and Visualization in R, and kindly contributed to R-bloggers)

This blog demonstrates how to produce political/provincial boundary map (below) using R maptools and raster packages.

## Load required packages
 ## Download data from
adm <- getData(‘GADM’, country=’PHL’, level=2)
mar<-(adm[adm$NAME_1==”Marinduque”,])plot(mar, bg=”dodgerblue”, axes=T)
##Plot downloaded data
plot(mar, lwd=10, border=”skyblue”, add=T)
plot(mar,col=”green4″, add=T)
invisible(text(getSpPPolygonsLabptSlots(mar), labels=as.character(mar$NAME_2), cex=1.1, col=”white”, font=2))
mtext(side=3, line=1, “Provincial Map of Marinduque”, cex=2)
mtext(side=1, “Longitude”, line=2.5, cex=1.1)
mtext(side=2, “Latitude”, line=2.5, cex=1.1)
text(122.08,13.22, “Projection: Geographic\nCoordinate System: WGS 1984\nData Source:\nCreated by: ARSsalvacion”, adj=c(0,0), cex=0.7, col=”grey20″)

To leave a comment for the author, please follow the link and comment on his blog: Data Analysis and Visualization in R. 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.