1.起因
在搜索如何存储经纬度坐标时,偶然发现了一个人写下这篇文章How to Store Latitude and Longitude in MySQL,文中提到:
This means we can use a DECIMAL(10, 8) column to store latitude and a DECIMAL(11, 8) column to store longitude in MySQL.
但是并没有给出如何得出这样奇怪的数值,抱着疑问,我打开了stackoverflow
2.基础知识
当我们开始存储经纬度时,我们要知道他们的取值范围:
经度0°——180°(东行,标注E)0°——180°(西行,标注W)
纬度0°——90°N、0°——90°S
也就是说,经度是0-180,纬度是0-90 .