'Python getting object has no attribute error but attribute exists in package documentation
I am trying to get the lat/lngs from a successful location search using the SearchControl class in ipyleaflet. Code is from the ipyleaflet documentation link. When I run the below example I get the error AttributeError: 'SearchControl' object has no attribute 'on_location_found'. I know the code as is wont get me what I need, but it was a starting point. Can anyone advise how I might be able to get the lat/lngs? New to this.
from ipyleaflet import Map, SearchControl
m = Map(center=[47, 2], zoom=5)
search = SearchControl(
position="topleft",
url='https://cartoradon.irsn.fr/commune.py/communes/search/FR/{s}?',
zoom=5
)
m.add_control(search)
def on_found(**kwargs):
# Print the result of the search (text, location etc)
print(kwargs)
search.on_location_found(on_found)
m
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
