Searching for city names in ios
Asked Answered
R

1

8

I want to provide a user-input field in my iPad app, where the user can type the name of a city or location, and the app should present a list of possible cities/locations where the user can select from, and I can get the geo coordinates from (to add markers on a MKMapView).

I tried CLGeocoder, but it seems it only gets me one result, plus the result ain't that accurate. For example, putting "Stutt" as address string yields "Straubing, germany" as result, wheareas "Stuttgart" will bring up "Stuttgart" (correct) as result (I would thus expect at least 2 results for "Stutt"). Also, theres a city called stuttgart in the US, which also was not given as result. (i used the sample code on the very bottom of this page: https://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/UsingGeocoders/UsingGeocoders.html)

Can anyone guide me to a proper solution for city name/location lookup based on user text input?

Recursion answered 15/2, 2012 at 19:59 Comment(0)
R
7

Found a solution:

The geonames webservice and the objective-c client api.

The client api also brings a ready-to-use search controller.

Recursion answered 16/2, 2012 at 7:20 Comment(2)
Thanks so much for answering your question! This was EXACTLY what I was looking for! You should mark this as the correct answer that way more people can find it!Leisurely
Thanks for the hint, wasn't aware that I should accept my own answer :)Recursion

© 2022 - 2024 — McMap. All rights reserved.