0

I currently have a mapView being displayed in an iPhone app. I'm wondering if there is a way to put an address field, allow the user to enter an address, and then have the map re-center over the coordinates of that particular address?

Would appreciate any help, thank you.

Jerry S.
  • 1
  • 1

2 Answers2

2

Yes, it's definitely possible. However, you will need to use a 3rd party api for the google forward geocoding (address --> lat/long).

http://blog.sallarp.com/ipad-iphone-forward-geocoding-api-google/

Forward geocode the address string and use annotation to place it on the map.

TommyG
  • 4,145
  • 10
  • 42
  • 66
  • There are built in geo-coders that are available. Even if they are using "Google" maps, the API's belong to Apple. – Bill Burgess Aug 30 '11 at 21:16
  • Apple only supports reverser geocoding. http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/LocationAwarenessPG/UsingGeocoders/UsingGeocoders.html#//apple_ref/doc/uid/TP40009497-CH4-SW1 – TommyG Aug 30 '11 at 21:24
0

There certainly is a way to do that. The way to do this would be to have a UITextField in which the user enters the address and a button, which when pressed sends over a web request to google map api which returns the actual longitude/latitude pertaining to the address and then the mapview can be re centered to those coordinates dropping a pin at that point.

EDIT: Explained above is the way I implemented it. Instead of a UiTextField and a button you can also use a UISearchBar and here's a nice link that can get you going.

How to search MKMapView with UISearchBar?

Community
  • 1
  • 1
Arsalan Habib
  • 1,395
  • 14
  • 20