I want to draw a route between two locations on the map. Something like a tour guide. When the tourist clicks another location, I want to be able to draw a route; as well as, inform about the distance from the current location.
I am aware of sites on the Internet which tell how to draw polylines on map. But, most of the examples had a preloaded .csv file with various coordinates.
Is there an alternative way to get the coordinates from Google or any other provider, as the location is selected dynamically.
If NO, how do I get the information for intermediate coordinates?
Does iOS 6 provide any direct way for this problem?
This is a tricky one. There is no way to do that with MapKit: it’s easy enough to draw lines when you know the coordinates, but MapKit won’t give you access to the roads or other routing information. I’d say you need to call an external API to get your data.
I’ve been playing with cloudmade.com API. The vector stream server should return what you need, and then you can draw that over your map. However, discrepancies between the Google maps and the OSM maps used by cloudmade may make you want to use cloudmade maps all the way: they have an equivalent to MapKit.
P.S.: Other mapping providers – Google, Bing, etc. may also provide equivalent data feeds. I’ve just been looking at OSM/Cloudmade recently.
P.P.S.: None of this is trivial newbie stuff! Best of luck!