As we know, a latitude value can be between -90 and +90 degrees, whereas a longitude value can be between -180 and +180 degrees. To get accuracy to within a meter, only six decimal places are needed, which is sufficient for most cases. But you can go even further by using eight places which will give you more than centimeter-level accuracy.

This means we can use a DECIMAL(10, 8) column to store latitude and a DECIMAL(11, 8) column to store longitude in MySQL.

In a Symfony2/Doctrine project we will use the following:



Need help with your next project?

Contact us

Privacy Preference Center