道路距离,两地之间的实际距离 [英] Road distance,Actual distance between two places

查看:91
本文介绍了道路距离,两地之间的实际距离的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用户开始驾驶之前计算两个位置[用户指定的位置]之间的驾驶距离。我也在CLLocation中使用了许多公式和getDistanceFrom,但我无法获得这些位置之间的完美距离。



实际距离和计算距离有很大差异。



请帮我计算两个地点之间的行车距离。
如何使用Google Maps API计算行车距离?

我已经使用regexkitlite在Google地图上显示两地之间的路径。但是我无法计算路径距离。



如果您有任何代码/链接,请将其发送给我。



提前致谢.... 解决方案

请参阅路线API 的Google地图

发出HTTP请求:

http://maps.googleapis.com/maps/api/directions/output?parameters



答案可能是 json xml 。你会在答案中找到距离

I want to calculate the driving distance between two locations [the user's specified locations], before user starts the driving. I used many formulas and getDistanceFrom in CLLocation also, but I am not able to get the perfect the driving distance between those locations.

There is much difference in actual and calculated distance.

Please help me to calculate the driving distance between two locations. How can I use Google Maps API to calculate the driving distance ?

I have already use the regexkitlite to show the road path on Google Maps between the two place. However I can't calculated the path distance.

If you have any code/link, please send it to me.

Thanks in advance....

解决方案

See directions API of Google Maps

You have just to make a HTTP request:
http://maps.googleapis.com/maps/api/directions/output?parameters

Answer could be json or xml. You will find the distance in the answer

这篇关于道路距离,两地之间的实际距离的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆