✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
📊 Dash 2.0 is Arriving. Register here.

Adding maps without using mapbox


is it somehow possible to draw a map on a dashboard without having to get an mapbox-key?
I would like to use my own custom shapefiles or use openstreetmap-data.

Thanks in advance &
kind regards :slight_smile:


If you work with shapefiles, you will probably need Shapely. And maybe also Cartopy.

To embed images in a Dash component, this answer and this thread might be useful.

See also:

Hi! Can you solve this? Is there any code example?

Thank you.

As I can see, this resources are not interactive as Mapbox (mouse hover, click actions, etc…). Am I right?

Thank you!

@masio_gelp You’re right: if you don’t use mapbox (or perhaps Google Maps), then your maps will be mostly static. users can hover over datapoints to get values, but can’t pan/zoom.

Here’s an example of a ScatterPlot Plotly plot which can quickly be turned into a full Plotly Dash app:

You can turn this (or any) Plotly example into Plotly Dash app by adding this code before the example code:

import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
app = dash.Dash()

And then at the end of a Plotly example where you see code like py.iplot( fig, filename='some_name' ), just replace it with these lines:

app.layout = html.Div([
    dcc.Graph(id='graph', figure=fig)

if __name__ == '__main__':

We’re working on adding the ability to use alternative tileservers in scattermapbox (e.g. open street map instead of mapbox). I’ll keep this thread updated with progress


Would love to see alternatives to MapBox. OSM is a great free alternative. Can’t wait to see it getting implemented and using it in my website.

1 Like

I would also like to see OpenStreetMap maps as an optional tileserver for the mapboxes. Any updates?

Yup! This was improved in July thanks to a customer that sponsored the development of this open source feature. See https://plot.ly/python/mapbox-layers/ for the new options.

1 Like

It is not working for images. :frowning:


mapbox_layers do work with sourcetype = 'image'. A detailed example is given as answer to your opened issue on plotly.py: https://github.com/plotly/plotly.py/issues/2056 .

Dash Leaflet supports any tile provider, i.e. also OSM, and it includes support for drawing polygons as well :slight_smile:

1 Like