Because Deck.gl is one of the most user-friendly WebGL javascript libraries and can produce some beautiful maps. And it integrates nicely with Mapbox.
You need a Mapbox
Access Token to load a map. Then call
mapdeck(token = token)
to give you a map
You can make your token available ‘globally’ to all
mapdeck()
calls by either
set_token()
, which sets the token as an
option
Sys.setenv()
) with the key one of
“MAPBOX_TOKEN”,“MAPBOX_KEY”,“MAPBOX_API_TOKEN”, “MAPBOX_API_KEY”,
“MAPBOX”, “MAPDECK”Here’s an example using set_token()
You can style the map using any mapbox style template styles, or you can create one of your own
I’ve provided a convenience function to select one of the mapbox defined styles
Once you have a map you can start adding layers through the various
add_*()
functions (there is an example of each one in this
vignette).
All details about layers, colours, tips & tricks, etc, are here