Map (ipyleaflet)





What's this?
No matching items

Relevant Functions

No matching items

Details

ipyleaflet allows us to create interactive maps via ipywidgets.

To insert an ipyleaflet map do the following tasks:

  1. Add shinywidgets.output_widget() to the UI of your app to create a div in which to display the map. Where you call this function will determine where the map will appear within the layout of the app.

  2. Provide an argument to the id parameter in the shinywidgets.output_widget() function call. This argument will be used to identify the map in the server function.

  3. Within the server() function, create your ipyleaflet map and assign it to a variable. Your map does not need to be created within a nested function in server() like many other shiny for python components.

  4. Register your map with shiny using shinywidgets.register_widget() by passing in the id of the map and the map variable.

Visit shiny.posit.co/py/docs/ipywidgets.html to learn more about using ipywidgets with Shiny.

Variations

GeoJSON and Markers

Read in country boundaries from a GeoJSON file and add markers to the map.





What's this?
No matching items