Description Usage Arguments Value Note See Also Examples
View source: R/staticmap_getEsrimapBrick.R
Uses the input coordinates to fetch and composite a raster from
the tile server. Returns a raster::rasterBrick
object. This
can then passed as the rasterBrick
object to the
staticmap_plotRasterBrick()
function for plotting.
As of July 2019, this list is a handy reference to the freely available tile servers which can be previewed at the following URL:
https://leaflet-extras.github.io/leaflet-providers/preview/
1 2 3 4 5 6 7 8 9 10 11 12 |
centerLon |
Map center longitude. |
centerLat |
Map center latitude. |
maptype |
Selects the appropriate Esri tile server. Options include:
|
zoom |
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,
|
maxTiles |
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 |
tileCacheDir |
Optional location for cached tiles. |
A rasterBrick object which can be plotted with
staticmap_plotRasterBrick()
or raster::plotRGB()
and serve as a
base plot.
The spatial reference of the image when it is downloaded is 3857. If the crs argument is different, projecting may cause the size and extent of the image to differ very slightly from the input, on a scale of 1-2 pixels or 10^-3 degrees.
If bbox is specified and the bbox aspect ratio does not match the width/height aspect ratio the extent is resized to prevent the map image from appearing stretched, so the map extent may not match the bbox argument exactly.
If both zoom
and maxTiles
are specified, maxTiles
takes precedence. To get a specified zoom level, set maxTiles = NULL
.
1 2 3 4 5 6 7 8 9 10 | ## Not run:
# Fail gracefully if any resources are not available
try({
rasterBrick <- staticmap_getEsrimapBrick(-122.3318, 47.668)
staticmap_plotRasterBrick(rasterBrick)
}, silent = FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.