【发布时间】:2015-05-23 05:47:43
【问题描述】:
我正在尝试创建一个 Android 应用程序,它会为我每移动 2 米提供我的位置更改更新。我使用的 API 是:
lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, (float)2, locationListener);
我可以用半正弦公式计算两个坐标之间的距离。
我想知道我在纬度和纵向上移动了多少距离。
我的意思是,我想知道delta(x) 和delta(y) 从以前的位置以米为单位。我有currentLat、currentLong、previousLat、previousLong。
例如:我在我的应用程序中获得以下 GPS 坐标:
Latitude: 12.9812007 Longitude: 77.74348163
Latitude: 12.98119122 Longitude: 77.74348192
Latitude: 12.98118058 Longitude: 77.74348131
Latitude: 12.9812041 Longitude: 77.74350371
Latitude: 12.98119337 Longitude: 77.74350154
Latitude: 12.98117935 Longitude: 77.74350156
Latitude: 12.9811742 Longitude: 77.74349111
Latitude: 12.98116478 Longitude: 77.74348577
Latitude: 12.98114454 Longitude: 77.7434776
Latitude: 12.98113244 Longitude: 77.74347141
Latitude: 12.98112247 Longitude: 77.74346629
Latitude: 12.98111381 Longitude: 77.74347568<br/>
Latitude: 12.98112889 Longitude: 77.74348118
Latitude: 12.9811384 Longitude: 77.74348133
Latitude: 12.98114325 Longitude: 77.74346866
Latitude: 12.9811306 Longitude: 77.74345533
Latitude: 12.98112043 Longitude: 77.74344925
Latitude: 12.98110867 Longitude: 77.74344979
Latitude: 12.98109571 Longitude: 77.74345256
Latitude: 12.98110153 Longitude: 77.74346184
Latitude: 12.98111135 Longitude: 77.74346482
Latitude: 12.98112283 Longitude: 77.74346764
Latitude: 12.98113165 Longitude: 77.74347133
Latitude: 12.98114311 Longitude: 77.74347645
Latitude: 12.98115332 Longitude: 77.74348057
【问题讨论】:
-
问题是什么?
-
将此作为评论,因为这只是一种解决方法:如果您设置了一个好的方法来计算实际距离,请继续使用它来获得您想要的,并为您的 delta(x) 传递在 2 long of 0... 对于 delta(y) 通过 2 lats of 0 .... 对于它的价值... ;-)
标签: android gps geolocation