Create tiles for a spatial dataset.
tiles(x, ...) # S3 method for default tiles(x, ...) # S3 method for RasterLayer tiles(x, output_dir, colors = "Spectral", zoom = "5-16", threads = 1, project = TRUE, verbose = FALSE, cache = TRUE, shiny = FALSE, ...)
x |
|
---|---|
... | not used. |
output_dir |
|
colors | The color palette (see |
zoom |
|
threads |
|
project |
|
verbose |
|
cache |
|
shiny |
|
character
tile scheme.
This function creates a tile layer, following the
Tile Map Service specification, using the object in argument to x
and saves it
in the argument to output_dir
.
# load leafleat library(leaflet) # load example data set data(netherlands, package = "mapmisc") # create leaflet map and visualize data using tiles map <- leaflet() %>% setView(lng = 5.75560, lat = 50.94723, zoom = 12) %>% addProviderTiles("Esri.WorldImagery", group = "Basemap") %>% addTiles(tiles(nldElev, output_dir = tempdir(), zoom = "10-16"), group = "Elevation", options = tileOptions(minZoom = 5, maxZoom = 16, tms = TRUE)) %>% addLayersControl(baseGroups = "Basemap", overlayGroups = "Elevation", options = layersControlOptions(collapsed = FALSE)) # render map print(map)