Reputation: 1
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.
Upvotes: 0
Views: 1653
Reputation: 4155
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.
Upvotes: 2
Reputation: 1395
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?
Upvotes: 0