search

Home  >  Q&A  >  body text

经纬度坐标 - 经纬度在mysql数据库中如何存储?

有一个要求是不能用double类型,float类型也不能用。
那么在mysql中使用什么样的类型存储经纬度比较合适呢?

如果要存为varchar类型,php中两者该如何转换呢?
如果存为int类型,是否要使用bigint,还是说int就能满足呢?

PHPzPHPz2773 days ago1581

reply all(3)I'll reply

  • 大家讲道理

    大家讲道理2017-04-17 13:28:43

    You can use string varchar, and then convert the string into double type or float type

    after taking out the data

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 13:28:43

    Mysql supports the Geometry type, but it is more troublesome to operate.

    reply
    0
  • PHPz

    PHPz2017-04-17 13:28:43

    Just convert it to plastic storage. If the accuracy is required to be 8 decimal places, multiply it by 10^8 and store it in the database

    reply
    0
  • Cancelreply