2

I'm looking to create a highly interactive map for the user. Not only an interactive map in the sense of visualization, where the user can move, zoom and click on the map to see a tooltip appear. But also where the user can for example click on an area (a polygon) and a python method is executed to cut the area into squares. A way to integrate the execution of python code in the map according to the user's interactions.

Is there a python solution to do this ? A tool or a specific library.

4
  • 1
    You can use Folium. Apr 24, 2021 at 12:20
  • Thanks @KadirŞahbaz, but are you sure we can add click event (as a function to execute) with Folium? Could you give me an example? I did not see that this was explicitly possible in the documentation.
    – Tim
    Apr 24, 2021 at 13:48
  • I'm not so sure. I didn't see it was possible in the documentation, too. You can also check Ipyleaflet library. Apr 24, 2021 at 13:59
  • Indeed at first glance Ipyleaflet seems to allow this. Thanks again !
    – Tim
    Apr 24, 2021 at 14:32

1 Answer 1

4

After some research, ipyleaflet seems to be the best soltion to meet your needs at the moment. You can read documentation.

It includes some classes which have useful events for you as follows:

  • Map (on_interaction)
  • Layer (on_click, on_dblclick, on_mousedown, on_mouseup, on_mouseover, on_mouseout)
  • Marker (on_move)
  • GeoJSON (on_click, on_hover)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.