开发者

Any advantage to storing latitude / longitude as integers?

开发者 https://www.devze.com 2023-01-23 15:13 出处:网络
Lately I\'ve noticed some of the resources (sample applications, blogs, and websites) I use for GPS / GIS stuff store the latitude and longitud开发者_运维百科e as integers rather than decimal or strin

Lately I've noticed some of the resources (sample applications, blogs, and websites) I use for GPS / GIS stuff store the latitude and longitud开发者_运维百科e as integers rather than decimal or string. I understand why a formatted string is not the preferred way to store lat / lon. But why not store the value as a decimal? Is there any advantage to storing as an integer and later dividing by 1,000,000 to get the actual decimal value?


Possibly. An integer requires only four bytes of storage. An IEEE double precision floating point number is 8 bytes. So storing a lat / lon as an integer would halve the memory requirement.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号