1

I have seen several answers but none seem to work ... I need to know the best MySQL data type to store a lat / lon value. An example lon value returned from the API:

-75.2408658

Currently, I have the column set to Decimal(10,7), but this rounds the value to the nearest tenth and stores as such:

-75.2408660

Any help would be greatly appreciated!!

Shane Hou
  • 4,808
  • 9
  • 35
  • 50
  • 1
    Try using mysql spatial extensions – alwaysLearn Apr 16 '13 at 04:15
  • I've looked into it but I can't seem to figure it out ... what do I need to do on the server side to convert the value to be stored in the DB? – Scott Newman Apr 16 '13 at 04:16
  • Keep in mind latitude and longitude with a precision of 4 decimal places is accurate to a scale of inches. – Bill Karwin Apr 16 '13 at 04:18
  • Well, I don't know why you don't just use `DOUBLE`. But then again, do you realise that the difference in your two values is approximately 1cm? Surely not worth getting fussy over. – paddy Apr 16 '13 at 04:19
  • possible duplicate of [What is the ideal data type to use when storing latitude / longitudes in a MySQL database?](http://stackoverflow.com/questions/159255/what-is-the-ideal-data-type-to-use-when-storing-latitude-longitudes-in-a-mysql) – Gajus Jun 15 '15 at 19:25

1 Answers1

0

Use MySQL's spatial extensions with GIS.

Already an SO thread is here .

This also might help you.

Community
  • 1
  • 1
Praveen Prasannan
  • 7,093
  • 10
  • 50
  • 70