API以编程方式获取行驶距离

API以编程方式获取行驶距离

本文介绍了通过Bing Maps API以编程方式获取行驶距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用Bing API,它可以完美运行,并且可以很好地输出纬度和经度

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 ?

推荐答案

路由API. Routes API用于计算行车路线.通过Routes API,您可以通过基于行驶,步行或交通的算法来获取路线距离计算,路线几何形状和分步路线.您还可以在路线上传递多达25个点,以在单个请求中计算出多站路线.

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.

样本:

http://dev.virtualearth.net/REST/v1/Routes?waypoint.1=waypoint1&waypoint.2=waypoint2&distanceUnit=mi&o=json&c=en- GB& key = key

看看Microsoft文档:

Take a look at the Microsoft documentation:

http://msdn.microsoft.com/en-us/library/ff701717.aspx 用Java做到这一点很容易.

http://msdn.microsoft.com/en-us/library/ff701717.aspxIt's easy to make this in Java.

这篇关于通过Bing Maps API以编程方式获取行驶距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 08:50