According to these definitions, we have the following description of the accuracy of the decimal places of latitude and longitude:
The digit of unit (a decimal degree) gives the position up to 111 kilometers (60 nautical miles, or 69 miles). It tells us what country we are in approximately.
The first decimal place goes up to 11.1 km: it differentiates the position of a large city from another large neighboring city.
The second decimal place goes up to 1.1 km: it separates one village from another.
The third decimal place up to 110m: it identifies a huge agricultural field or an institutional campus.
Fourth to every decimal goes up to 11m: it identifies a portion of earth. It is comparable to the common precision of a GPS unit without any interference.
The fifth decimal place goes up to 1.1m: it differentiates one tree from another. The precision of this level in commercial GPS can only be achieved with differential correction.
The sixth decimal place Worth up to 0.11 m: you can see the structure in detail, to design landscapes or build streets. It should be more than enough to monitor glacier and river movements. This can only be measured with very robust GPS.bold text
From the seventh decimal place it comes to millimeters and nanometers, so you don’t have a need for more than 6 houses to save and recover geolocations with an acceptable accuracy.
Completion
The exchange of the $casts
is really the best way to treat your problem
That said, you have two possibilities to be able to work the return correctly on your $casts
:
- Change the type to:
protected $casts = [
'latitude' => 'float', // pode ser real, float ou double
'longitude' => 'float', // pode ser real, float ou double
];
- Or just convert into your controller to decimal using
(decimal)$company->latitude
The second possibility solves the problem, even if it is the least recommended of the two.
Please avoid long discussions in the comments; your talk was moved to the chat
– Maniero