Hi,
I want to give the user the option of changing the map tiles (as in satellite vs map).
I have an example running here:
http://54.191.230.199:5006/bokeh_map
The problem is that after switching the tiles a few times, the data points disappear and the plot becomes unresponsive. No errors/warnings given; same behavior in several browsers I tried.
(Note that sometimes the tiles do not update until there is some action (pan/zoom). Although not ideal, I can live with that.)
It seems to me that if the user zooms in/out before changing the tiles, the problem is delayed, but it will manifest itself eventually.
My code:
bokeh serve --show bokeh_map.py
from bokeh.io import curdoc
from bokeh.models import WMTSTileSource
from bokeh.layouts import column, row
from bokeh.plotting import Figure
from bokeh.models.widgets import RadioButtonGroup
from pyproj import Proj, transform
tiles = [(‘OpenMap’, WMTSTileSource(url=‘http://c.tile.openstreetmap.org/{Z}/{X}/{Y}.png’)),
(‘ESRI’, WMTSTileSource(url=‘https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{Z}/{Y}/{X}.jpg’)),
(‘Wikimedia’, WMTSTileSource(url=‘https://maps.wikimedia.org/osm-intl/{Z}/{X}/{Y}@2x.png’))]
active_init=1
def update_tiles(active):
plot.add_tile(tiles[active][1])
layer_group = RadioButtonGroup(labels=[tiles[i][0] for i in range(len(tiles))], width=600, active=active_init)
layer_group.on_click(update_tiles)
plot = Figure(plot_width=800, plot_height=800, active_scroll=‘wheel_zoom’)
plot.circle(x=[-10875914, -10880367, -10884819], y=[3540881, 3529283, 3540881], size=8, fill_color=“blue”)
plot.add_tile(tiles[active_init][1])
curdoc().add_root(column(layer_group, plot))
``
Any ideas why this happens are much appreciated,
Alex