Created
April 1, 2016 22:22
Star
You must be signed in to star a gist
plot ESRI shapefiles - Google Maps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shapefile overlapping Google Maps | |
library(ggplot2) | |
library(ggmap) | |
library(rgdal) | |
# geographical centre of Poland | |
poland <- get_googlemap(c(lon=19.27, lat=52.03), | |
zoom = 6, | |
maptype = "satellite") | |
polandMap <- ggmap(poland) | |
polandMap | |
powiats <- readOGR(".","POL_adm2") | |
powiats <- spTransform(powiats, CRS("+proj=longlat +datum=WGS84")) | |
powiats <- fortify(powiats) | |
polandMap <- polandMap + | |
geom_polygon(aes(x = long, y = lat, group = group), | |
fill = 'grey', | |
size = .2, | |
color = 'red', | |
data = powiats, | |
alpha = 0) | |
polandMap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment