本文介绍了如何计算两点之间的驾驶距离?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我使用纬度,经度地点坐标> GeocodeService 现在我想要在这些地方之间获得距离。



我试过 GetDistanceTo 驾车距离?。如何计算两个位置之间的距离



提前致谢

解决方案

必须使用Bing Routes API(或Google,但我认为您使用Bing地图)。



有一个使用api查找驾驶的示例这里两个地方之间的路线:



一般的电话是:


您必须注册Bing Maps API密钥,然后将location1和位置2与您喜欢的位置。



距离应该在json或xml

travelDistance
>

In my app I am getting the latitude , longitude co-ordinates of places using GeocodeService now I want to get distance between these places.

I've tried GetDistanceTo method to get the distance two location co-ordinates but it gives me stright distance.

How can I calculate driving distance between two locations?

thanks in advance

解决方案

To calculate the driving distance you'll have to use the Bing Routes API (or Google, but I assume you're using Bing Maps).

There's an example of using the api to find a driving route between two places here: http://msdn.microsoft.com/en-us/library/gg636957.aspx

The general call is:http://dev.virtualearth.net/REST/V1/Routes/Driving?o=xml&wp.0=location1&wp.1=location2&avoid=minimizeTolls&key=BingMapsKey

You'll have to register for a Bing Maps API key, and then replace location1 and location2 with the locations you like.

The distance should be returned in travelDistance in the json or xml

这篇关于如何计算两点之间的驾驶距离?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-06 12:10