PWFSLSmoke (version 1.2.100)

staticmap_getStamenmapBrick: Create a rasterBrick from stamenmap tiles

Description

Downloads a PNG from the stamenmap tile server and creates a raster::rasterBrick object with layers for red, green, and blue. This can then passed as the rasterBrick object to the staticmap_plotRasterBrick() function for plotting.

Stamen maps tiles are freely available (April, 2019) and are described at the following URL:

http://maps.stamen.com/#terrain/12/37.7706/-122.3782

"These tiles are made available as part of the CityTracking project, funded by the Knight Foundation, in which Stamen is building web services and open source tools to display public data in easy-to-understand, highly visual ways."

Usage

staticmap_getStamenmapBrick(centerLon = NULL, centerLat = NULL,
  maptype = "terrain", zoom = 12, width = 640, height = 640,
  bbox = NULL, crs = sp::CRS("+init=epsg:4326"),
  tileCacheDir = tempdir())

Arguments

centerLon

map center longitude

centerLat

map center latitude

maptype

map type

zoom

map zoom level; corresponds to ggmap::get_map() zoom level

width

width of image, in pixels

height

height of image, in pixels

bbox

bounding box vector (lonLo, latLo, lonHi, latHi). If not null, centerLon, centerLat, and zoom are ignored.

crs

object of class CRS. The Coordinate Reference System (CRS) for the returned map. If the CRS of the downloaded map does not match, it will be projected to the specified CRS using raster::projectRaster.

tileCacheDir

Optional location for cached tiles.

Value

A rasterBrick object which can be plotted with staticmap_plotRasterBrick() or raster::plotRGB() and serve as a base plot.

See Also

staticmap_getRasterBrick

staticmap_plotRasterBrick

Examples

Run this code
# NOT RUN {
rasterBrick <- staticmap_getStamenmapBrick(-122.3318, 47.668)
staticmap_plotRasterBrick(rasterBrick)
# }

Run the code above in your browser using DataLab