Database/SQL: How to store longitude/latitude data?

后端 未结 8 1202
醉酒成梦
醉酒成梦 2020-12-07 10:03

Performance question ...

I have a database of houses that have geolocation data (longitude & latitude).

What I want to do is find the best way to store t

相关标签:
8条回答
  • 2020-12-07 10:43

    I would store it as integers (int, 4-bytes) represented in 1/1,000,000th degrees. That would give you a resolution of few inches.

    I don't think there is any intrinsic spatial datatype in MySQL.

    0 讨论(0)
  • 2020-12-07 10:48

    I know you're asking about MySQL, but if spatial data is important to your business, you might want to reconsider. PostgreSQL + PostGIS are also free software, and they have a great reputation for managing spatial and geographic data efficiently. Many people use PostgreSQL only because of PostGIS.

    I don't know much about the MySQL spatial system though, so perhaps it works well enough for your use-case.

    0 讨论(0)
提交回复
热议问题