Reputation: 281
How can i get the shortest distance from source A to Destination B using the MapKit in iphone. Is there any way to implement this? Thank you.
Upvotes: 1
Views: 1527
Reputation: 612
Assuming that you are looking for routing, you need to fetch the routes from a routing server. Check Google directions API. CloudMade also has routing api. I don't think MapKit provides a way to fetch routes and find shortest distance.
If you are looking for straight line distance use:
CLLocation *aLocation = …
CLLocation *differentLocation = …
[aLocation distanceFromLocation:differentLocation];
Upvotes: 1
Reputation: 22587
For route mapping, I'm pretty sure the best option is still to fire up the maps application appropriately parameterised....
Try here http://mobile.tutsplus.com/tutorials/iphone/iphone-sdk-quick-tip-launching-maps-in-app/
Thanks
Upvotes: 0