如何获取“公路距离”在谷歌地图 API 中?
如果您尝试获取以下距离:
- Presidente Vargas 817, Centro RJ
- rua de santana macaé rj
在 Maps v3 APIcomputeDistanceBetween() 中,您会得到 *155*566.80511451405...但是..
在maps.google中:你得到:187公里!!!
更新:Maps.google返回公路距离,有办法得到这个距离?
If you try get the distance of:
- Presidente Vargas 817, Centro RJ
- rua de santana macaé rj
in Maps v3 API computeDistanceBetween(), you got *155*566.80511451405...but..
in maps.google: you got: 187 km !!!
UPDATE: Maps.google returns the distance by road, have a way to get this distance?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
computeDistanceBetween()
函数会直接给出以米为单位的结果。当汽车行驶时,maps.google.com 示例会给出以公里为单位的结果。因此路线稍微长一些。两点之间的实际行驶距离几乎永远不会匹配它们之间的最短距离。
The
computeDistanceBetween()
function is giving you a result in meters, as the crow flies. The maps.google.com example is giving a result in kilometers, as the car drives. Thus the route is slightly longer.The actual driving distance between two points will almost never match the shortest possible distance between them.