Pages

Monday, August 6, 2012

Provincial Map using GADM

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")
view raw Marinduque.r hosted with ❤ by GitHub

2 comments:

  1. Hi, I would like to know how to plot some values (lets say correlation coeffcient along with color bar) carried out on gridded latitude and longitude. lets say with equal interval of 0.5 x 0.5 degree

    ReplyDelete
  2. Hi, can you please tell me how to shade color based on some values like proportion / mean etc.? Thank you.

    ReplyDelete