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:

 

/**
 * @ORM\Column(type="decimal", precision=10, scale=8)
 */
protected $lat;

/**
 * @ORM\Column(type="decimal", precision=11, scale=8)
 */
protected $lng;

 

Privacy Preference Center