Map figure with open street map and PC local tiles

Hi,

I’d like to have a map image along with dash.
I’ve seen that it can use open street map.

While testing it on one computer which connected to internet, the map is downloaded from the web.

Now I need to work with it in a closed network which doesn’t have connection to the web. I’ve downloaded the tiles I require. How can I use those tiles locally?

You should setup a tile server locally, and set the tile URL to the URL of that tile server.

OK. URL can handle the local files as well, isn’t it?
How do I set the URL?

You can change the tile URL (it is called source in Plotly context) as demonstrated in the example here,

There should be no difference between using the URL of a “normal” tile server and an “offline” tile server that you are hosting yourself.

So I’ve configured

df = ...

fig = px.scatter_mapbox(df, lat="lat", lon="lon")
fig.update_layout(
    mapbox_style="white-bg",
    mapbox_layers=[
        {
            "below": 'traces',
            "sourcetype": "raster",
            "source": [
                "file:///H:/ABC/GeoData/{z}/{y}/{x}"
            ]
        }
      ])
fig.update_layout(margin={"r":0,"t":0,"l":0,"b":0})
fig.show()

Where H:\ABC\GeoData contains the tiles themselves (z = 7,8,…)

I’m starting my application from the chrome and what happens is that the IE is opened all the time probably trying to load the tiles.

How can I solve that it would be opened in same chrome tab?

As noted in my previous post, you should setup a tile server that serves the tiles to the map. I have previously used Terracotta, but there are lots of options. Here is a complete example,

Where and how download the tiles?