Skip to content

Instantly share code, notes, and snippets.

@erzk
Created April 1, 2016 22:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save erzk/46a3ce1146770d6ef5bf6fe3c3b0fbb9 to your computer and use it in GitHub Desktop.
plot ESRI shapefiles - Google Maps
# 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