Offline maps using raster tiles

Hello,

I’m wondering if it’s possible to use a tile provider with plotly instead of mapbox.
I have to work offline, and have a local openstreetmap tiles server, I would like to use thos tiles to make a slippy map in a dash application. On this map I then want to overlay a scatter plot (with 10k+ points) and some polygons.
It is possible with Bokeh as explained here but I have not found a way to do it with plotly nor Dash.

Thanks for you help,

1 Like

@D.Ticien Thanks for your post. I am also looking to do this. Did you find a solution?

Hi,

Sorry for the late answer, I managed to do it, but with vector tiles, not raster tiles.
Apparently raster tiles support is ongoing but currently not supported by Dash.

If you’re interested in the vector tiles for an offline mode, here is how I managed to make it work :

  1. Have a tile server running, I used this docker image with OpenStreetMap mbtiles :

Docker image : https://hub.docker.com/r/klokantech/tileserver-gl/
OpenStreetMap Mbtiles files can easily be found on the web.

  1. As of Dash : In the layout of the Mapbox map :
  • Provide a dummy mapbox key (You don’t need an actual Mapbox key as you’re using your own tileserver, however, the mapbox key cannot be an empty string (I don’t know why though …)
  1. Finally, set the ‘style’ property of the layout to the GL style json URL.
    If you use Klokantech docker image : you can click on the GL Style button (see screenshot : https://openmaptiles.org/media/tileserver_gl_styles.png) and copy paste the link to the json file.

After those 3 steps, it should work like a charm!