gpt4 book ai didi

android - Google Map V2 Android 和 iOS 放置 latlng 小数位

转载 作者:可可西里 更新时间:2023-11-01 03:39:03 27 4
gpt4 key购买 nike

我正在开发一个 Android 和 iOS 应用程序。这两个应用程序都使用谷歌的 PlaceAutocomplete Controller 来获取位置的经纬度。在 iOS 中,我们得到经纬度最多 6 位小数,有时也有 5 位。在 android 中,我们得到超过 6 位小数。 Android 和 iOS 相同位置坐标的精度不同。

For example consider location Pune
Android Latlng: 18.520431,73.856744
iOS Latlng: 18.52043,73.856744

因此,如您所见,同一位置的纬度精度存在差异。

有没有办法避免这种情况,因为我的应用程序需要比较这些经纬度?

最佳答案

您不应依赖坐标的精度来比较它们,因为它们可能会发生变化,或者在您进行实验时会因平台而异。

相反,您可以设置容差来确定两个位置是否相同。例如:

float YOUR_TOLERANCE = 1; // 1 meter
if (location.distanceTo(otherLocation) < YOUR_TOLERANCE) {
// Both locations are considered the same
}

关于android - Google Map V2 Android 和 iOS 放置 latlng 小数位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37966046/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com