Skip to content
Advertisement

How to get a regular form field to autocomplete a geosearch with Leaflet’s Geosearch plugin?

I’m trying to get a regular form field used for searching for an address to autocomplete its values, as seen on this page, using Leaflet Geosearch plugin.

So far the documentation says it can be binded to a form. Jquery UI’s autocomplete looks like it can accomplish this, however i have not been able to wrap my head around how to do it.

I have successfully linked the form field to the geosearch provider, and it returns an array that can be seen in the browser console. I can algo get the autocomplete plugin to work, but with a local array, not the one produced by the geosearch plugin.

Here is an example of both plugins in action separately:

JavaScript

I’d greatly appreciate any pointers in the right direction on how to get the autocomplete to work with the geosearch provider.

Advertisement

Answer

This should work, but I don’t know how to check at the moment because https://nominatim.openstreetmap.org/ is currently not working.

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement