如何获取“公路距离”在谷歌地图 API 中?

发布于 2024-11-25 12:27:30 字数 693 浏览 1 评论 0原文

如果您尝试获取以下距离:

  1. Presidente Vargas 817, Centro RJ
  2. rua de santana macaé rj

在 Maps v3 APIcomputeDistanceBetween() 中,您会得到 *155*566.80511451405...但是..

ma​​ps.google中:你得到:187公里!!!

更新:Maps.google返回公路距离,有办法得到这个距离?

If you try get the distance of:

  1. Presidente Vargas 817, Centro RJ
  2. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

囚我心虐我身 2024-12-02 12:27:30

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文