# Offline maps using raster tiles

**URL:** <https://community.plotly.com/t/offline-maps-using-raster-tiles/14119>\
**Category:** Dash Python\
**Created:** [October 1, 2018, 7:45pm UTC](https://community.plotly.com/t/offline-maps-using-raster-tiles/14119 "2018-10-01T19:45:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![D.Ticien](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@D.Ticien](https://community.plotly.com/u/D.Ticien)\
**Post date:** [October 1, 2018, 7:45pm UTC](https://community.plotly.com/t/offline-maps-using-raster-tiles/14119/1 "2018-10-01T19:45:16Z")

</div>

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](https://bokeh.pydata.org/en/latest/docs/user_guide/geo.html) but I have not found a way to do it with plotly nor Dash.

Thanks for you help,

---

<div class="post-metadata">

**Author:** ![eddyb](https://avatars.discourse-cdn.com/v4/letter/e/aeb1de/32.png) [@eddyb](https://community.plotly.com/u/eddyb)\
**Post date:** [February 7, 2019, 4:08pm UTC](https://community.plotly.com/t/offline-maps-using-raster-tiles/14119/2 "2019-02-07T16:08:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![D.Ticien](https://avatars.discourse-cdn.com/v4/letter/d/bbe5ce/32.png) [@D.Ticien](https://community.plotly.com/u/D.Ticien)\
**Post date:** [February 19, 2019, 8:42pm UTC](https://community.plotly.com/t/offline-maps-using-raster-tiles/14119/3 "2019-02-19T20:42:19Z")

</div>

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/](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](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!

---

<div class="post-metadata">

**Author:** ![kriaga](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/kriaga/32/27616_2.png) [@kriaga](https://community.plotly.com/u/kriaga)\
**Post date:** [April 8, 2024, 7:12am UTC](https://community.plotly.com/t/offline-maps-using-raster-tiles/14119/4 "2024-04-08T07:12:20Z")

</div>

Hey @D.Ticien, I know this is an old thread but havent found anything better yet, I am trying what you have suggested, running the docker image with the .mbtile files. Integrated it in my dash app as you suggested and gave some dummy string as well in the accesstoken.  
The code works when I am connected to the internet and stops when I disconnect. Even though I dont see any network calls being made outside, why is it that maplayers are not coming?

```auto
fig.update_layout(
    mapbox=dict(
        style="http://[::]:8080/styles/basic-preview/style.json",
        accesstoken="dummystring",
        zoom=10,
    )
)

```
