GPS数据的存储格式
我正在尝试将 GPS 数据存储在 Sqlite 数据库中。我通过 DDMS 从 KML 文件检索数据,并以这种方式将其存储在 GeoPoint 中:
GeoPoint p = new GeoPoint(latitude,longitude)
问题是 GeoPoint()
仅接受 lon 和 lat 作为 int,因为它没有定义为双精度格式。现在,如果我有 45.3242355 作为经度,它将作为 int-453242355 存储在 Sqlite 中。我想用它在地理点之间的地图上画一条线,但我可以,因为这种整数格式超出了纬度和经度的范围。有人可以告诉我应该如何继续取回我的真实格式数据吗?
I'm trying to store GPS data in a Sqlite database. I retrieve the data from a KML file via DDMS and I store it in a GeoPoint this way:
GeoPoint p = new GeoPoint(latitude,longitude)
The problem is that GeoPoint()
accepts lon and lat only as int, as it is not defined for double format. Now if I have 45.3242355 as longitude this is stored in Sqlite as int-453242355. And I want to use this to draw a line on the map between geopoints, but I can as this format of integer is out from tje range of latitude and longitude. Can someone tell me how should I proceed to get my real format data back?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将其乘以 10^-6 (1e-6)(要将双精度型转换为其整数格式,请乘以 10^6 (1e6))。 GeoPoint 使用的整数格式不会丢失数据,它只是以微度而不是度为单位,如 文档。
(这类似于货币字段将 2.36 美元的值存储为“236”的方式,以简化算术并避免昂贵的浮点数学和 FP 错误)。
Multiply it by 10^-6 (1e-6) (and to convert from a double to their integer format, multiply by 10^6 (1e6)). The integer format used by GeoPoint isn't losing data, it's just in microdegrees instead of degrees, as specified by the documentation.
(This is similar to the way a currency field might store a value of $2.36 as "236" to simplify arithmetic and avoid expensive float math and FP errors).