Learn R Programming

ggmap (version 2.2)

get_stamenmap: Get a Stamen Map

Description

get_stamenmap accesses a tile server for Stamen Maps and downloads/stiches map tiles/formats a map image.

Usage

get_stamenmap(bbox = c(left = -95.80204, bottom = 29.38048, right = -94.92313, top = 30.14344),
    zoom = 10,
    maptype = c("terrain", "watercolor", "toner"),
    crop = TRUE, messaging = FALSE, urlonly = FALSE,
    filename = "ggmapTemp", color = c("color", "bw"), ...)

Arguments

bbox
a bounding box in the format c(lowerleftlon, lowerleftlat, upperrightlon, upperrightlat).
zoom
a zoom level
maptype
terrain, watercolor, or toner
crop
crop raw map tiles to specified bounding box
messaging
turn messaging on/off
urlonly
return url only
filename
destination file for download (file extension added according to format)
color
color or black-and-white
...
...

Value

  • a map image as a 2d-array of colors as hexadecimal strings representing pixel fill values.

Details

accesses stamen maps.

See Also

http://maps.stamen.com/#watercolor, ggmap

Examples

Run this code
gc <- geocode('duncan hall, rice university')
google <- get_googlemap('rice university', zoom = 15)
ggmap(google) +
  geom_point(aes(x = lon, y = lat), data = gc, colour = 'red', size = 2)

bbox <- as.numeric(attr(google, 'bb'))[c(2,1,4,3)]
names(bbox) <- c('left','bottom','right','top')
stamen <- get_stamenmap(bbox, zoom = 15)
ggmap(stamen) +
  geom_point(aes(x = lon, y = lat), data = gc, colour = 'red', size = 2)

osm <- get_openstreetmap(bbox, scale = OSM_scale_lookup(15))
ggmap(osm) +
  geom_point(aes(x = lon, y = lat), data = gc, colour = 'red', size = 2)


ggmap(get_stamenmap(bbox, zoom = 15, maptype = 'watercolor'))+
  geom_point(aes(x = lon, y = lat), data = gc, colour = 'red', size = 2)

ggmap(get_stamenmap(bbox, zoom = 15, maptype = 'toner'))+
  geom_point(aes(x = lon, y = lat), data = gc, colour = 'red', size = 2)

Run the code above in your browser using DataLab