tags:

views:

265

answers:

1

I want to update a MapView in an iPhone app. Using a geocordinate, this is trivial. But what if I don't know the coordinate? I want to update it using an address string, like you would enter in the text box of google maps.

To give a little more background, in my app a MapView is displayed with the user's current location. After the location is retrieved, I use the ReverseGeocoder to translate it into a human readable address, that is displayed in a TextView below the map.

But the location is often wrong - this app will mainly be used in New York City and the iPhone GPS is often inaccurate here (due to tall buildings?). In this case, the user can tap the text view and put in the actual address. At this point, I want the MapView to update with the address they entered. But it's not obvious to me how to make that happen.

A: 

The iPhone SDK doesn't provide that functionality. You will need to use a geocoding service like Google Geocoding API.

Google API provides an HTTP service to look up geolocation. For example, to determine the location for Google headquarter, you can query

http://maps.google.com/maps/geo?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA&output=csv&oe=utf8&sensor=true_or_false&key=your_api_key

You can also change the results format.

notnoop