malhal / Laravel-Geographical

Easily add longitude and latitude columns to your records and use inherited functionality for calculating distances
MIT License
281 stars 49 forks source link

Geofence returns long numbers #29

Open Atmden opened 4 years ago

Atmden commented 4 years ago

Hello! When I call scope geofence I get long numbers of coordinates and distances. For example: The database contains the coordinates: latitude 57.161948 longitude 50.316044

In response, I get latitude 57.16194800000000242334863287396728992462158203125 longitude 50.31604399999999799319994053803384304046630859375 distance 1.580186425277957606994050365756265819072723388671875

How can I reduce the returned numbers to 6 decimal places, how are they stored in the database?

malhal commented 3 days ago

You can use round for that