crazycapivara / mapboxer

An R Interface to Mapbox GL JS
https://crazycapivara.github.io/mapboxer/
Other
55 stars 7 forks source link

Mapboxer extras #66

Open Camil88 opened 3 years ago

Camil88 commented 3 years ago

Hello, I would like to manually draw a polygon on a map. I've been searching for such an option in mapboxer but couldn't find. I would also like to manually draw an area on a map which selects points (coordinates) and e.g. calculate some statistics for the points instantly. In general, I'd like to use options available in package leaflet.extras. Please take a look here for working example: https://gist.github.com/mndrake/aee9a0f5c53018860e46766d0131cd29

My question is if it's possible to mix mapboxer with leaflet.extras to use all options available there? Or maybe mapboxer can't be mixed in any way with leaflet functions?

crazycapivara commented 3 years ago

@Camil88 leaflet and mapbox are two different libraries, so you cannot use the leaflet plugins in mapbox. Here you can see some available mapbox plugins, but they need to be bind to R aswell. That is what the leaflet.extras package does for some leaflet plugins. The drawControl is already included in mapboxer, so you can use add_draw_control to draw polygons onto the map. Unfortunately I did implement sending data back to R (Shiny), so that you can use it in your app to check whether some points are within the polygon. But that is not a big issue. Furthermore, I already added some plugins that are only available in mapboxer like add_filter_control, see also here.

crazycapivara commented 3 years ago

67

Camil88 commented 3 years ago

Ok, thank you for your explanation.