Bug in distance calculation on geolocation sorting

To whom this concerns

I have been trying to make a sorting system for my firebase farmacies by geolocation. I have a full database of pharmacies and their corresponding geolocation by radiance. I want to find the ones whitin a certain distance but the algorithm shown here in the community does not return the correct distance. I cannot see the bug and have tried lots of different things.
Can anyone see a bug


Is this a degrees or radians thing ?

This tutorial shows one way to sort a List of locations National Park Tutorial (Markers) updated

It may help. Otherwise debug your Blocks. Show an example of how you store the locations please.



As you can see in the firebase screen shot the stored data is in radianse not degrees and are hereby used directly in the Haversine algorithm.

I know all the geolocations go through but it not the right distance coming out.

They look like decimal degrees to me.....

Using Google Maps, your first set of coordinates drop me in the sea just off Rønne, Denmark ? Which seems like an odd place for a pharmacy?

I have reed a lot and every time a geolocation is made a degrees unit is found and it says something like 23 degrees north. I thought the radiance number is the decimal number. I will try to make a convertion.

There are farmacies in many odd places.

converting the decimal degrees to radians solved the problem. Thanks.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.