I’m trying to enable the save tool on a tilemap that has an overlaid image, with no success, the save icon does not even show up.
As usual, live colab notebook here:
https://colab.research.google.com/drive/1qKR0AJvdxffZIbSF0xeZAgzy_dFTn2hk?usp=sharing
hv.help(hv.Tiles) has a row like this:
Name Value Type Bounds Mode
default_tools ['save', 'pan', 'wheel_zoom', 'box_zo... List (0, None) V RW
If I understand it correctly, save should be turned on by default. However, no matter what I try, I can not make the save icon to appear for a map.
import holoviews as hv, bokeh as bk, numpy as np
print({'hv': hv.__version__, 'bk': bk.__version__})
left, right, top, bottom = 3490000, 3510000, 3490000, 3510000
savetest_tiles = hv.element.tiles.OSM().opts(xlim=(left, right), ylim=(top, bottom), tools=['save'])
savetest_tiles
This results in:
{'hv': '1.14.3', 'bk': '2.3.1'}
As you can see, the save icon is not displayed.
If I display some random image in itself with the ‘save’ option, it works, I even get two save icons. I don’t know why that is, but I don’t care about this right now.
savetest_image = hv.Image(np.random.rand(1,1), bounds=(left,bottom,right,top)).opts(alpha=0.4, tools=['hover', 'save'])
savetest_image
If I overlay the two, again, I don’t have a save icon:
savetest_combined = (savetest_tiles * savetest_image).opts(tools=['save'])
savetest_combined
What’s curious is that in Bokeh everything works as it should:
from bokeh.plotting import figure, output_file, show
from bokeh.tile_providers import OSM, get_provider
from bokeh.models import ColumnDataSource
output_file("tile.html")
source = ColumnDataSource(
data=dict(lat=[ top, top, bottom, bottom],lon=[left, right, right, left])
)
map = figure(x_range=(left, right), y_range=(top, bottom),
x_axis_type="mercator", y_axis_type="mercator")
map.add_tile(get_provider(OSM))
show(map)
Even if I combine multiple elements:
combined = map
combined.patch(x="lon", y="lat", fill_color="blue", fill_alpha=0.2, source=source)
show(combined)
I should mention that every time the save button shows up, it works as it should, there are no problems there.
Does anybody have an idea how to turn on the save tool or if HV has a bug that prevents it, how to reach the underlying Bokeh map that clearly is capable of that? Thanks!