Skip to content

Commit 94368a1

Browse files
committed
Add docs for locationfound event
1 parent 78c5455 commit 94368a1

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

docs/source/api_reference/search_control.rst

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,27 @@ Example
2121

2222
m
2323

24+
You can add a callback that will be run when on search found:
25+
26+
.. jupyter-execute::
27+
28+
m = Map(center=[47, 2], zoom=5)
29+
30+
search = SearchControl(
31+
position="topleft",
32+
url='https://cartoradon.irsn.fr/commune.py/communes/search/FR/{s}?',
33+
zoom=5
34+
)
35+
m.add_control(search)
36+
37+
def on_found(**kwargs):
38+
# Print the result of the search (text, location etc)
39+
print(kwargs)
40+
41+
search.on_location_found(on_found)
42+
43+
m
44+
2445
You can also search features from GeoJSON layers.
2546

2647
.. jupyter-execute::
@@ -77,5 +98,6 @@ Methods
7798
================ ===================================== ===
7899
Method Arguments Doc
79100
================ ===================================== ===
101+
on_location_found Callable object Adds a callback on location found event.
80102
on_feature_found Callable object Adds a callback on found event for searching in GeoJSON layer.
81-
================ ===================================== ===
103+
================ ===================================== ===

0 commit comments

Comments
 (0)