问题
I have been working with Bing API and it works perfect and outputs latitude and longditude very well
// However I need the driving distance . . . I thought it should be result.getDrivingDistance (
System.out.println(result.getDrivingDistance); // There is no such a command
// What should I do to get the distance from the response ?
Is there any way of getting the driving distance? I have been reading documentation but was not able to find a method for this ?
回答1:
Routes API. The Routes API is for calculating driving directions. The Routes API allows you to get route distance calculations, route geometry and step-by-step directions via driving, walking or traffic based algorithms. You can also pass in up to 25 points on your route to calculate a multiple stop route in a single request.
sample:
http://dev.virtualearth.net/REST/v1/Routes?waypoint.1=waypoint1&waypoint.2=waypoint2&distanceUnit=mi&o=json&c=en-GB&key=key
Take a look at the Microsoft documentation:
http://msdn.microsoft.com/en-us/library/ff701717.aspx It's easy to make this in Java.
来源:https://stackoverflow.com/questions/21357073/getting-driving-distance-using-bing-maps-api-programmatically