Provincial Map using GADM

[This article was first published on Data Analysis and Visualization in R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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



## Load required packages
library(maptools)
library(raster)

 ## Download data from gadm.org
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)
grid()
box()
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: GADM.org\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 their blog: Data Analysis and Visualization in R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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)