将纬度/经度存储为整数有什么好处? [英] Any advantage to storing latitude / longitude as integers?

查看:35
本文介绍了将纬度/经度存储为整数有什么好处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我注意到我用于GPS/GIS的一些资源(示例应用程序,博客和网站)将纬度和经度存储为整数,而不是十进制或字符串.我了解为什么格式化的字符串不是存储lat/lon的首选方式.但是为什么不将值存储为小数呢?将其存储为整数并随后除以1,000,000以获取实际的十进制值有什么好处?

Lately I've noticed some of the resources (sample applications, blogs, and websites) I use for GPS / GIS stuff store the latitude and longitude 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?

推荐答案

可能.整数仅需要四个字节的存储空间.IEEE双精度浮点数为8个字节.因此,将lat/lon作为整数存储会减少一半的内存需求.

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.

这篇关于将纬度/经度存储为整数有什么好处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆