This question may be a little out of place here, but here goes:
It has also been posted to stack overflow.
I'm using the wonderful leaflet package in R and I'm wondering if there is a way to have a tooltip such that:
1- the user could draw a rectangle and
2- the code could estimate the actual physical size of the rectangle (in, say, feet) given the zoom level of the map and legs of the tooltip rect
## This doesn't work and mixes metaphors from leaflet and ggvis
## It's just pseudocode to give intuition
library(leaflet)
library(ggvis)
lb <- linked_brush()
map <- leaflet() %>% addTiles() %>% addCircleMarkers() %>% lb()
size <- lb()$rect_width * lb()$rect_height * map$zoom_factor