What is the ideal data type to use when storing latitude / longitude in a MySQL database?

前端 未结 21 2730
梦如初夏
梦如初夏 2020-11-22 09:40

Bearing in mind that I\'ll be performing calculations on lat / long pairs, what datatype is best suited for use with a MySQL database?

21条回答
  •  时光取名叫无心
    2020-11-22 10:23

    We store latitude/longitude X 1,000,000 in our oracle database as NUMBERS to avoid round off errors with doubles.

    Given that latitude/longitude to the 6th decimal place was 10 cm accuracy that was all we needed. Many other databases also store lat/long to the 6th decimal place.

提交回复
热议问题