User city for profile


I’d like to allow the user to enter his home town in his profile (using Yii2-user) and get it’s coordinates (to later show how far appart users are).

I tried getting the geonames database, but it’s very slow for the user to select a city.

I was hoping to be able to query google maps api for a quick autocomplete input field or something similar (ideally free).

Any ideas ?

I’ve see there are google maps extensions, but I don’t need to display maps or anything, just to select the city and get it’s latitude and longitude to calculate distances.

Thanks !