mt_map_extent_data | R Documentation |
Given a range of x and y values (which correspond to longitude and latitude,
respecitively), the function determines a set of map tiles that cover the
region. Tiles are downloaded from a URL and stored in a local cache. A
data frame suitable for plotting with geom_image_bbox
is returned.
mt_map_extent_data(
xmin,
xmax,
ymin,
ymax,
zoom = NULL,
zoom_adj = 0,
aspect_ratio = NULL,
cache_dir = NULL,
alpha = 1,
url = NULL,
force = FALSE,
quiet = FALSE
)
xmin |
minimum value of the bounding box to cover: degrees of longitude |
xmax |
maximum value of the bounding box to cover: degrees of longitude |
ymin |
minimum value of the bounding box to cover: degrees of latitude |
ymax |
maximum value of the bounding box to cover: degrees of latitude |
zoom |
integer giving the zoom value, from 0 (entire world) to 19; set to NULL to auto-compute an appropriate zoom level |
zoom_adj |
integer giving an adjustment to the default zoom level; negative values zoom out from the default and positive values zoom into the default. Useful to avoid accidentally downloading a large number of tiles (by setting a very large zoom value for a region) and for adjusting facetted plots. Ignored when an explicit zoom is supplied. |
aspect_ratio |
positive numeric value giving the desired aspect ratio of the tiles. When set to NULL, the default, tiles are choosen to cover the data points without regard to the aspect ratio. |
cache_dir |
string giving the location of a local path in which to download the tile files; if set to NULL, will first check for the option "mt_cache_dir"; if also missing, will determine a suitable temporary location that persistsduring the R session |
alpha |
optacity of the tiles; default is 1 (solid). |
url |
url of the tile server, given as a string with three values of "%d", which will be filled in with the zoom, x, and y values; if missing, will taken from the option "mt_url"; otherwise will be set to: "http://tile.stamen.com/toner/%d/%d/%d.png". |
force |
logical; should tiles be downloaded if they already exist? Defaults to FALSE. Useful if the url is changed or there was a network issue with the tiles. |
quiet |
logical; should a message be shown indicating what tiles are being downloaded and used? Set to FALSE by default. |
Returns a data frame with one row per tile, containing a bounding box of the tile and the local location where the file is located.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.