开发者

MapKit - How can I implement directions from Source and Destination in my iphone app using MapKit?

开发者 https://www.devze.com 2023-03-13 22:52 出处:网络
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.Assuming that you are looking for routing, y

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.


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];


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

0

精彩评论

暂无评论...
验证码 换一张
取 消