我应该在我的数据库中为GPS坐标存储多少个有效数字? [英] How many significant digits should I store in my database for a GPS coordinate?

查看:833
本文介绍了我应该在我的数据库中为GPS坐标存储多少个有效数字?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的MySQL数据库中有经度和纬度坐标(GPS数据)。

I have in my MySQL database both longitude and latitude coordinates (GPS data).

它目前存储为:

column     type
------------------------
geolat     decimal(10,6)
geolng     decimal(10,6)

问题: / strong>我真的需要一个大小为十进制(10,6)的数据类型才能正确存储坐标数据?

Question: Do I really need a data type as large as decimal(10,6) to properly store coordinate data?

由于我对经度和纬度有一个组合索引,这个索引的大小是巨大的。

Since I have a combined index on the longitude and latitude, this index size is huge. If I can make it smaller without compromising anything, that would be great.

推荐答案

WGS84 datum通常以完全十进制表示法的坐标给出,通常具有5个小数位,因此对于纬度(-90到+90)使用十进制(7,5)(-90.00000到90.00000),对于经度,您可以使用十进制(8,5)(-180.00000到180.00000)。

WGS84 datum are usually given as coordinates in a fully decimal notation, usually with 5 decimal places, so for latitude (-90 to +90) you could use decimal(7, 5) (-90.00000 to 90.00000), for longitude you could use decimal(8, 5) (-180.00000 to 180.00000).

.00001 < a href =http://en.wikipedia.org/wiki/Wikipedia:WikiProject_Geographical_coordinates#Precision =noreferrer>在赤道处获得大约1米的精度

DECIMAL / NUMERIC数据类型是固定精度缩放整数,并且范围的正部分和负部分始终可用 - 它们不影响精度或缩放(有明显的存储需要它,但是你没有得到关于DECIMAL的选择)

The DECIMAL/NUMERIC data type is a fixed precision scaled integer and both positive and negative parts of the range are always available - they do not affect the precision or scale (there is obviously storage required for it, but you don't get a choice about that for DECIMAL)

这篇关于我应该在我的数据库中为GPS坐标存储多少个有效数字?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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