17

Consider the example in the following link for Folium: US Employment visualization per county.

The result looks like what you see below:

    enter image description here

I would like to add a search box to it to be able to search by city, and have the visualization zoom in and/or center around it.

How can I go about adding such search box to it, perhaps by adding functionality in the HTML file?

PolyGeo
  • 65,136
  • 29
  • 109
  • 338

1 Answers1

22

You could use the Leaflet search control. It allows you to insert a search widget on your map, search by place names around the world (see Nominatim example), and once a place is selected, zoom/center your map to that place location.

enter image description here

In the Leaflet search's GitHub website you find examples on how to add the control to your leaflet map.

Kadir Şahbaz
  • 76,800
  • 56
  • 247
  • 389
Germán Carrillo
  • 36,307
  • 5
  • 123
  • 178