Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

addCopyExtent

Copy current view extent to the clipboard


Description

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://keycode.info/ to find the approprate codes for your keyboard.

Usage

addCopyExtent(map, event.code = "KeyE")

Arguments

map

a mapview or leaflet object.

event.code

the JavaScript event.code for ley strokes.

Examples

library(leaflet)

  leaflet() %>%
  addProviderTiles("CartoDB.Positron") %>%
    addCopyExtent(event.code = "KeyE") %>%
    addMouseCoordinates()

  # now click on the map (!) and zoom to anwhere 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>)

leafem

'leaflet' Extensions for 'mapview'

v0.1.3
MIT + file LICENSE
Authors
Tim Appelhans [cre, aut], Christoph Reudenbach [ctb], Kenton Russell [ctb], Jochen Darley [ctb], Daniel Montague [ctb] (Leaflet.EasyButton plugin), Lorenzo Busetto [ctb], Luigi Ranghetti [ctb], Miles McBain [ctb], Sebastian Gatscha [ctb], Björn Harrtell [ctb] (FlatGeobuf plugin), Daniel Dufour [ctb] (georaster-layer-for-leaflet)
Initial release
2020-07-19

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.