Thursday October 28 5:00 PM – Thursday October 28 7:00 PM in Workshop/Tutorial II

Map Visualizations with Dash Leaflet

Haw-minn Lu

Prior knowledge:
Previous knowledge expected
Python, Jupyter, Geographic data, some experience with Dash is recommended by not required. Workshop materials: or r/westhealth/pydata-leaflet-tutorial


Dash leaflet is a lightweight wrapper around the popular React Leaflet.js library. Enabling Python users to produce data driven geographic visualizations down to street level maps. Because dash leaflet is a lightweight wrapper, customization requires some degree of manual configuration. This teaches how many perform complex customizations required for highly interactive map based visualizations.


This workshop takes the participant from development to deployment of a data driven geographical visualization. The majority of the workshop is given as a sequence of Jupyter notebooks. Participants will work through the notebooks.

We’ll load a dataset in geopandas and explore the GeoDataFrame, talk about the bounds and centroid methods. We’ll talk about GeoDataFrame and relationship to geojson and geobuf formats and the features in dash-leaflet express that facilitate the conversion between the geographic formats

There will be a crash course on setting up a simple dash app. Followed by an overview of dash leaflet components. Dash leaflet has a multitude of dash components. We will introduce the four (Map, TileLayer, GeoJSON, and ColorBar) which are used by the examples and are the most important. The participant will run through exercises with the TileLayer which provides the underlying map and learn the proper way to cite the appropriate attributes.

Participants will use the provided state and county level data to build basic visualizations on top of an open street map. They will customize the visualization with tooltips and popups. Participants will customize the rendering (weight, color and opacity) of counties and states. Navigation behavior configured using various zoom properties of the GeoJSON component.

Once the basics are mastered, the participants will produce a choropleth map based on the provided data and learn to customize the color gradient using the ColorBar component and tools provided by dash leaflet. Participants will use dash callbacks to generate an info box with the map visualization.

Participants will use the provided data to place points of interest on a map as a scatter map. We will compare many of the customizations such as tooltips and pins, navigation through zoom properties to those of the outline feature maps. Participants will customize the markers through assets, embedded HTML and through Marker classes. Interactivity will be added to the scatter map.

Dash leaflet incorporates Mapbox’s supercluster library for fast client side clustering (we should know we tried a bunch!). Clustering enables multiple points to be represented by a marker cluster when scatter points are too close together.

Participants will learn to activate clustering on a scatter map and the parameters to control the manner of clustering. Depending on interest and time, discussion of customization of markers and access to underlying data in each cluster will be discussed.

Finally, we will layer a scatter map with a state/county boundary map and deploy it to a local stand alone visualization. We will discuss options for deployment in a production environment.