32

I need to know on which city my users are.

I cannot use a regular text input since there are similar named cities and users can call the same city by different names,.

I want to let users type their city and display a list of similar results, I could do it with a world cities database, jquery and sql but I'm really not dying to do it from a scratch.

Is there any api (e.g: google) that has an unique ID for each city in the world and let's you search them? Could you post a link to a similar implementation?

1 Answer 1

28

There is the Google Places Autocomplete API, https://developers.google.com/places/documentation/autocomplete

and a library for Maps Version 3 at https://developers.google.com/maps/documentation/javascript/places#places_autocomplete

but I don't know how well it will cope with different names for the same city — although, having tried it, it does present Munich, Germany for munchen — see how well your use case performs.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks a lot I had no idea there was such API.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.