Skip to content

43 search control

image image image

Uncomment the following line to install leafmap if needed.

1
# !pip install leafmap
1
import leafmap

Add a search control to the map. See the Nominatim Usage Policy.

1
2
3
4
m = leafmap.Map(draw_control=False)
url = "https://nominatim.openstreetmap.org/search?format=json&q={s}"
m.add_search_control(url)
m

Search for features in GeoJSON files or any GeoPandas supported vector data.

1
2
3
4
5
6
7
8
9
m = leafmap.Map(draw_control=False, layers_control=True)
url = "https://raw.githubusercontent.com/opengeos/leafmap/master/examples/data/countries.geojson"
m.add_geojson(
    url,
    layer_name="Countries",
    fill_colors=["red", "yellow", "green", "orange"],
    info_mode=None,
)
m