This is a minimal demo of using autocomplete with the nextzen/leaflet-geocoder plugin. It handles most of the work for you and should work out of the box with any Leaflet map.
The leaflet-geocoder plugin sends requests generated by a keypress to
/v1/autocomplete
, but on enter, sends a request to /v1/search
. This ensures
the low-latency, partial input aware autocomplete endpoint is used most of the
time. The /v1/search
endpoint, which has enhanced logic for complete inputs, is used when necessary.
To get your own API key to add autocomplete to your website, visit Geocode Earth.
python3 -m http.server 8800