Issues with custom mapbox maps

When I make a custom style on mapbox, and try to use it with dash, I often times run into a bug where the map loads as only the background color of the map until I press home on the map, and zoom out.

For instance, it will happen if I try to customize the ‘light’ style of mapbox, and just take away the POI layer. You can try with this style as an example:


Has anybody had success in making custom styles? Has anyone run into this problem before?

Here is what it looks like in dash:

1 Like

Same here, would also like to know the reason for this and a possible fix.

Same problem here. The only style that works for me is from this post: Custom Mapbox Studio style in Dash

I don’t know why.

I have the same problem-- my map style won’t show up until I reset the view, and then it doesn’t fully load-- what’s weird is that it’s only one layer on top of the standard “light.” I tried making the style public-- perhaps that will push it to the mapbox CDN and make the tiles more readily available?

Hey, any progress or solution? Im having the same problem right now! Thx

So my use case for the map style was leveraging a base Mapbox tileset that I adjusted with some additional geojson to choropleth a few specific areas. I then wanted to layer a quick px.scattermapbox over those polygons and didn’t want the hassle of updating the fig.layout with additional layers. Because of the issue above, I did indeed end up splitting the geojson into separate sets of polygons, giving each of them their own color, and adding them below the topmost mapbox style layer-- which was state-label-sm or something like that. This added at least 10mb of data to the eventual deliverable, which is not great.

I am left wondering whether the incompatibility between the mapbox style and the plotly library is one that will be resolved in future updates to plotly.js (or whether this has already happened based on recent mapbox integration improvements) which will filter down to and friends.

I haven’t looked into the exact issues with custom mapbox account layers, but for geojson choropleth use cases, note that the latest version of dash has a new chart type called choroplethmapbox that allows you to provide geojson and color the shapes by values. Examples in the docs are getting published this evening.

See examples of the new chart types:

Hey it would be really cool, if wed get the custom layers working! Thx for everything tho, cheers

Thanks @chriddyp, great to know these recently landed. They may indeed obviate the need for the futzing I described earlier in the thread.