Reputation: 11
We are working on a mobile app that needs the user's city to work correctly and we want to give the user the freedom of entering the city by themselves.
We have a list of around 24k+ cities from around the world but we have users started coming from other locations that are not in our database and they are not able to sign up because we don't have their city on our list.
Any advice on where can we get a list of all cities in the world or how we can solve the problem any other way?
We only need city name, country, and its lat/long.
Thanks
Upvotes: 1
Views: 226
Reputation: 14401
Your use case seems to fit what IP geolocation is for. You can pre-fill a user form based on information guessed from its IP address.
Here is an example using Ipregistry: https://api.ipregistry.co/?key=tryout&pretty=true
The information you can guess is the city name, country, lat/long, and much more. However, you should understand that whatever IP geolocation service you are using, the answer is not 100% accurate and sometimes accuracy is limited to the country or region level but this should not be an issue in the case you enrich an existing form. Most of the users will appreciate the time you save them.
Upvotes: 0