Chapter 6. Geocoding and Reverse Geocoding
In This Chapter
Finding an address for a map coordinate and displaying on the map
Finding the map coordinate from an address and displaying it on the map
Geocoding allows you to take an address and turn it into a map coordinate. Reverse geocoding allows you to take a map coordinate (your current location, for example) and turn it into an address. In this chapter, you add both kinds of functionality to RoadTrip. You also (finally) get rid of those annoying compiler warnings.
Reverse Geocoding
Being able to see where I am on an iPhone map has some visual appeal — that dot is a real nice shade of blue — but I'm an exacting kind of guy who'd like to know exactly where I am in the scheme of things. I'd like to know the street address of where I'm standing, in other words. Geocoding makes that possible. (If I have the address, I can also write some code to turn the iPhone's current address into an Address Book contact — I show that to you in Book VII.)
Being able to go from a coordinate on a map to an address is called reverse geocoding, and thankfully the ability to do that is supplied by the MapKit
. Forward geocoding, the kind of geocoding that converts an address to a coordinate, doesn't come with the MapKit
, although many free and commercial services are available. I talk more about those options in the next section.
Tip
Keep in mind that the location may not be completely accurate — that whole horizontalAccuracy
thing I talk about in Chapter 5
Get iPhone® Application Development All-In-One For Dummies® now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.