if (FALSE) # cut down on R CMD check time
# grab a center/zoom map and compute its bounding box
gc <- geocode("white house, washington dc")
map <- get_map(gc)
(bb <- attr(map, "bb"))
(bbox <- bb2bbox(bb))
# use the bounding box to get a Stadia map
stadMap <- get_stadiamap(bbox)
ggmap(map) +
geom_point(
aes(x = lon, y = lat),
data = gc, colour = "red", size = 3
)
ggmap(stadMap) +
geom_point(
aes(x = lon, y = lat),
data = gc, colour = "red", size = 3
)
Run the code above in your browser using DataLab