I am currently working on a Panel app where a first step is to ask the user to select a region on a map. I am able to use geoview’s Polygons to show this map, and if I add the tool “Tap”, I am able to select one or more polygons in the map. However, I am unable to retrieve this information! It seems that the tap selection works at the bokeh level and I haven’t been able to find where to get the info in holoviews…
Minimal working example as I do it in my notebook:
import geopandas as gpd import geoviews as gv import holoviews as hv gv.extension('bokeh') hv.extension('bokeh') countries = gpd.read_file('https://github.com/johan/world.geo.json/raw/master/countries.geo.json') polys = gv.Polygons(countries, vdims=['name']) polys.opts( tools=['hover', 'tap'], width=600, )
This allows you to select 1 or more countries, but how do you get the info?
(Minor question : Here the colors are magically generated from the name attribute. Is there a way to put a single color for all shapes?)