Hello,
I have a question about the scattermapbox functionality in Plotly, specifically with respect to the refresh of map tiles when zooming in/out while using a custom tile server url.
After zooming into a map a couple of steps, I try to zoom out the same amount of steps, but somehow the tiles do not seem to refresh and the map shown is different to the map I started with.
For example, this is easier to notice when the name of a country (or city) suddenly appears on the map after zooming 1 step in. But when you zoom 1 step out right after, the name keeps showing on the map.
I noticed, however, that the name of the country disappears after panning and having the country or city name go beyond the plotly map borders.
Is that a known behavior, a bug, or something wrong in my code?
You can use the code below to reproduce the behavior:
<html>
<head>
<script src='https://cdn.plot.ly/plotly-latest.min.js'></script>
</head>
<body>
<div id='myDiv'></div>
</body>
<script>
var data = [{
type:'scattermapbox',
lat:[],
lon:[],
}]
var layout = {
dragmode: "zoom",
mapbox: {
style: "white-bg",
layers: [
{
sourcetype: "raster",
source: ["https://b.tile.openstreetmap.org/{z}/{x}/{y}.png"],
below: "traces",
}
],
center: {lat: 40.0, lon: -80.0},
zoom: 1.0,
},
}
Plotly.newPlot('myDiv', data, layout)
</script>
</html>
Note: I noticed that the first example at [https://plotly.com/javascript/mapbox-layers/] is using
mapbox: { style: โopen-street-mapโ}
and the tile refresh works fine when zooming in/out. So I took the tile server url it is calling underneath
(https://b.tile.openstreetmap.org/{z}/{x}/{y}.png) and used it on โlayout.mapbox.layersโ as a custom tile server url, in which case the tile refresh is showing the behavior Iโm explaining above.
Thank you.