addMapboxTiles {mapboxapi} | R Documentation |
Use a Mapbox style in a Leaflet map
Description
See the Mapbox Static Tiles API documentation for more information.
Usage
addMapboxTiles(
map,
style_id,
username,
style_url = NULL,
scaling_factor = c("1x", "0.5x", "2x"),
access_token = NULL,
layerId = NULL,
group = NULL,
options = leaflet::tileOptions(),
data = leaflet::getMapData(map),
attribution = TRUE
)
Arguments
map |
A map widget object created by |
style_id |
The style ID of a Mapbox style |
username |
A Mapbox username |
style_url |
A Mapbox style URL |
scaling_factor |
The scaling factor to use when rendering the tiles. A
scaling factor of |
access_token |
Your Mapbox access token; which can be set with
|
layerId |
the layer ID |
group |
The name of the group the Mapbox tile layer should belong to (for use in Shiny and to modify layers control in a Leaflet workflow) |
options |
A list of extra options (optional) |
data |
The data object used to derive argument values; can be provided
to the initial call to |
attribution |
If |
Value
A pointer to the Mapbox Static Tiles API which will be translated appropriately by the leaflet R package.
Examples
## Not run:
library(leaflet)
library(mapboxapi)
leaflet() %>%
addMapboxTiles(
style_id = "light-v9",
username = "mapbox"
) %>%
setView(
lng = -74.0051,
lat = 40.7251,
zoom = 13
)
## End(Not run)