【问题标题】:Which is more accurate JSON or sphericalutil.computedistancebetween in getting the distance between two address在获取两个地址之间的距离时,哪个更准确 JSON 或sphericalutil.computedistancebetween
【发布时间】:2017-02-25 13:44:14
【问题描述】:

我需要知道两个位置的准确距离(纬度)。我做了 JSON 和sphericalutil.computedistancebetween 但他们的结果太不同了。像这个例子,当我得到距离赌注时。 JSON 中的两个位置的结果是 9.8 公里,而在sphericalutil.computedistancebetween 9.18 公里我知道球面实用程序的结果是米我刚刚将它转换为公里。我将等待答案,请向我解释两者的区别。希望得到答案。非常感谢。

【问题讨论】:

  • JSON 是什么意思?您使用什么方法/API 来衡量?
  • 我只是使用 DIRECTION_URL_API 和我的 Google api 键来获取对象 w/c 是与 JSON 数组的距离。

标签: android json google-maps spherical-coordinate


【解决方案1】:

Google Directions API 返回两点之间的路线,因此返回的距离考虑了返回的路线(例如行驶路线)。

SphericalUtil.computeDistanceBetween 将两点之间的距离计算为地球上两个LatLngs 之间的最短距离。这是两点之间的排序路径(参考椭球上的弧),不考虑路线。

【讨论】:

  • 非常感谢您的回答。现在我知道该用什么了。
猜你喜欢
  • 1970-01-01
  • 2010-11-02
  • 1970-01-01
  • 1970-01-01
  • 2013-04-23
  • 2011-02-14
  • 1970-01-01
  • 1970-01-01
  • 2013-01-29
相关资源
最近更新 更多