addCopyExtent | R Documentation |
Add JavaScript functioality to enable copying of the current view bouding box
to the clipboard. The copy.btn
argument expects a valid keycode
event.code
such as "KeyE" (the default).
Use https://www.toptal.com/developers/keycode/ to find the
approprate codes for your keyboard.
addCopyExtent(map, event.code = "KeyE")
map |
a mapview or leaflet object. |
event.code |
the JavaScript event.code for ley strokes. |
library(leaflet)
leaflet() %>%
addProviderTiles("CartoDB.Positron") %>%
addCopyExtent(event.code = "KeyE") %>%
addMouseCoordinates()
# now click on the map (!) and zoom to anywhere in the map, then press 'e' on
# your keyboard. This will copy the current extent/bounding box as a JSON object
# to your clipboard which can then be parsed with:
# jsonlite::fromJSON(<Ctrl+v>)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.