PWFSLSmoke (version 1.2.100)

staticmap_getRasterBrick: Create a rasterBrick from a tiled image server

Description

Uses the input coordinates to select an appropriate method to build a raster::rasterBrick object. It will either use the staticmap_getStamenmapBrick() function or the staticmap_getEsrimapBrick() function This can then passed as the rasterBrick object to the staticmap_plotRasterBrick() function for plotting.

Usage

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

Arguments

centerLon

Map center longitude.

centerLat

Map center latitude.

maptype

Defaults to Esri Topographic Available to select between Stamen basemaps or Esri basemaps. Stamen

  • terrain

  • terrain-background

  • terrain-labels

  • terrain-lines

  • toner

  • toner-background

  • toner-hybrid

  • toner-labels

  • toner-labels

  • toner-lines

  • toner-lite

  • watercolor

Esri

  • "world_topo"

  • "world_imagery"

  • "world_terrain"

  • "de_Lorme"

  • "world_grey"

  • "world_streets"

zoom

Map zoom level.

width

Width of image, in pixels.

height

Height of image, in pixels.

bbox

If you are using the Esri maps, then the bbox parameter must be an st_bbox object as specificed in the sf package documentation https://www.rdocumentation.org/packages/sf/versions/0.7-4/topics/st_bbox. If using Stamen Maps, use a vector organized as (lonLo, latLo, lonHi, latHi) If not null, centerLon, centerLat, and zoom are ignored.

maxTiles

Only utilized if selecting an esri basemap, specifies the maximum number of tiles to be returned. The greater the number, the slower the performance -- arbitrarily set to 20 by default.

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_getStamenmapBrick

staticmap_getEsrimapBrick

staticmap_plotRasterBrick

Examples

Run this code
# NOT RUN {
rasterBrick <- staticmap_getRasterBrick(-122.3318, 47.668)
staticmap_plotRasterBrick(rasterBrick)
# }
# NOT RUN {
rasterBrick <- staticmap_getRasterBrick(-122.3318, 47.668, "world_streets", 12)
staticmap_plotRasterBrick(rasterBrick)
# }
# NOT RUN {
rasterBrick <- staticmap_getRasterBrick(-122.3318, 47.668, "watercolor", 12)
staticmap_plotRasterBrick(rasterBrick)
# }

Run the code above in your browser using DataLab