在获取两个地址之间的距离时,JSON 或 sphericalutil.computedistancebetween 哪个更准确

Which is more accurate JSON or sphericalutil.computedistancebetween in getting the distance between two address

我需要知道两个位置的准确距离 (latlng)。我做了 JSON 和 sphericalutil.computedistancebetween,但它们的结果相差太大。就像这个例子,当我得到距离赌注时。 JSON 中的两个位置,结果是 9.8 公里,sphericalutil.computedistancebetween 中是 9.18 公里,我知道 spherical util 结果为米,我只是将其转换为 KM。我将等待答案,请向我解释两者的区别。希望得到答案。非常感谢。

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

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