iphoneobjective-cmapkitcloudmade

Calculating driving distance in iPhone


I need to find the driving distance between 2 locations. I do not need to display the directions in a map, just need to calculate the distance, which I need to use in my application.

Does MapKit allow this? Is there an alternative that can be used?

I am able to get forward geo-coding using CloudMade, but there doesn't seem to be an option to obtain driving distance.

Appreciate any help.


Solution

  • CloudMade also offers driving directions. If you are only interested in the distance, simply ignore the instructions.

    An API-Call looks like this:

    http://navigation.cloudmade.com/YOUR-API-KEY-GOES-HERE/api/0.3/47.25976,9.58423,47.26117,9.59882/car/shortest.js

    and the JSON includes

    ....
    route_summary: {
    total_distance: Distance in meters,...
    

    Source