Skip to main content
2 of 4
deleted 1 characters in body
djq
  • 16.3k
  • 31
  • 112
  • 182

Data types for storing lng/lat in SQL

I'm storing a large list of lnt/lat points in a MySQL database. At the moment these are projected points for the UK in M, but in the long term I would like to make sure that I can store the coordinates of points for all over the world. What datatype should I use?

I started using decimal(18,12), but was unsure whether this precision is needed or whether I could just use a float. I included my code, in case there is anything else I should be considering:

CREATE TABLE UKTest
(
lat FLOAT,
lng FLOAT
)

I'm quite new to SQL so I'm unsure whether the data type is significant when running a query. I assumed that the overall memory would vary based on the variable type. Is there a benefit of using a spatial database over a basic MySQL database for this type of work?

djq
  • 16.3k
  • 31
  • 112
  • 182