smeijer / leaflet-geosearch

A geocoding/address-lookup library supporting various api providers.
https://smeijer.github.io/leaflet-geosearch/
MIT License
1.02k stars 270 forks source link

Google Provider Autocomplete Results #381

Open Hossam-Ali opened 8 months ago

Hossam-Ali commented 8 months ago

Hello, Thank you for the amazing library.

I have a question regarding Google Provider. The autocomplete is not working as expected as I have to write the exact address and returns very limited results.

I can see, you are using https://maps.googleapis.com/maps/api/js/GeocodeService.Search for the autocomplete results. While on Google API they use https://maps.googleapis.com/maps/api/place/js/AutocompletionService.GetPredictions

My code

Screenshot 2023-10-10 at 6 36 55 PM

Google API

Screenshot 2023-10-10 at 6 38 15 PM

Is there anyway to improve that? Thank you!

ffkarine commented 3 months ago

Hey @Hossam-Ali could you provide me a sample code of how you configured the Google Provider, since it seems to be working for you (at least for the exact adresses)? I'm not able to make it work, no matter the address I search, no results appear on the screen. However if I use the OSM provider it works (the results are kind of obsolete but it works). I already opened an issue here but no comments yet.