I've followed the examples but I can never get the ipyleaflet SearchControl
to work in my JupyterLab notebook:
import json
from ipyleaflet import Map, GeoJSON, SearchControl, LayerGroup
m = Map(center=(40, -100), zoom=10)
data = {}
# fill data as {'layer': GeoDataFrame}
search_space = LayerGroup()
for layer in data:
search_space.add_layer(
GeoJSON(data=json.loads(data[layer].to_json(drop_id=True)))
) # `data[layer]` is a geopandas GeoDataFrame
m.add_control(SearchControl(
position = 'topleft',
layer = search_space,
))
Even when I grab the same JSON file used in the docs, I still suffer the error that no search term is ever found.
Additionally, I've noticed the map populates with unclickable markers when I attach the controls to map. These markers align with the locations from my data. So something is happening, but it is certainly wrong behavior.
Running ipyleaflet 0.17.0 on Python3.
I had no idea what property_name
did because it was undocumented. I created a PR to fix it.