I'm working on a iPhone-application, and within one section the user should be able to search for cities. I would like to do it like the weather app is working on the iPhone, where user can start type and get a response right away with "matching" city names. For each city in the result I need to get; name of the city, county/state, country, longitude, and latitude.
Are there any free API for this, that you can use in a commercial iphone-application (that might cost money)?
What would be the best way to actually perform the live-search? I means of, to not put to much pressure on the server.. If the user types 2 characters, and the continue to type one more, and so on, then that will be a lot of requests to the server? (im thinking of having a "proxy" script on my server that calls the API for geo-info...
Thanx
Take a look at this free database from MaxMind. It contains the following fields:
I would suggest that the best thing to do is load this into your own database, and provide a simple web service for lookups, as you have proposed. If you put a proper index on your database, lookups will be fairly fast. It's small enough that you could even load the whole table into memory.