smeijer / leaflet-geosearch

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

Google Provider Autocomplete Results #381

Open Hossam-Ali opened 1 year ago

Hossam-Ali commented 1 year 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 8 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.