I want to use Pydeck to visualize locations of interest pulled from OpenStreetMaps using a ColumnLayer
. I want to draw a radius around each object. I'm currently drawing 2 column layers, one that has a smaller radius and taller height, and one that has a larger radius and smaller height, like so.
from OSMPythonTools.nominatim import Nominatim
from OSMPythonTools.overpass import overpassQueryBuilder, Overpass
# Get theaters in region of interest via OpenStreetMap
bbox = [48, 11, 49, 12]
query = overpassQueryBuilder(bbox=bbox, elementType='node', selector='"amenity"="cinema"',out='body')
overpass = Overpass()
result = overpass.query(query)
result_nodes = result.nodes()
import numpy as np
import pydeck as pdk
import pandas as pd
# Format them into a dataframe for visualization
lat = np.array([r.lat() for r in result_nodes])
lon = np.array([r.lon() for r in result_nodes])
id = np.array([r.id() for r in result_nodes])
df = pd.DataFrame({'lat': lat, 'lon': lon, 'id': id})
view = pdk.data_utils.compute_view(df[['lon', 'lat']])
view.pitch = 40
view.bearing = 10
theaters = pdk.Layer(
"ColumnLayer",
data=df,
get_position=["lon", "lat"],
get_elevation=5000,
radius=200,
get_fill_color=[255, 255, 255, 255],
pickable=True,
auto_highlight=True,
)
range = 20000
theaters_range = pdk.Layer(
"ColumnLayer",
data=df,
get_position=["lon", "lat"],
get_elevation=1000,
radius=range,
get_fill_color=[100, 255, 100, 20],
pickable=True,
auto_highlight=True,
)
r = pdk.Deck(
layers=[theaters, theaters_range],
initial_view_state=view
)
r.to_html()
However, I don't want the green radius circles and white location indicator cylinders to be independently selectable. I want it so that when the mouse hovers over a white cylinder, both the white cylinder and the green radius indicator are selector and are highlighted together. They both have the same id, assigned from OpenStreetMaps. Is there a way to do that?
Thanks!