Skip to content

Instantly share code, notes, and snippets.

@gatoravi
Forked from mollietaylor/nationalParksArea.R
Last active August 29, 2015 14:04
Show Gist options
  • Save gatoravi/b6622cf6dabcbf90183f to your computer and use it in GitHub Desktop.
Save gatoravi/b6622cf6dabcbf90183f to your computer and use it in GitHub Desktop.
# load up area shape file:
library(maptools)
area <- readShapePoly("ne_10m_parks_and_protected_lands_area.shp")
# # or file.choose:
# area <- readShapePoly(file.choose())
library(RColorBrewer)
colors <- brewer.pal(9, "BuGn")
library(ggmap)
mapImage <- get_map("Saint Louis, USA",
color = "color",
source = "osm",
# maptype = "terrain",
zoom = 6)
area.points <- fortify(area)
ggmap(mapImage) +
geom_polygon(aes(x = long,
y = lat,
group = group),
data = area.points,
color = colors[9],
fill = colors[6],
alpha = 0.5) +
labs(x = "Longitude",
y = "Latitude")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment