Topic: GeoPoint.Distance : result is not in meters ?

Hello,

I'm trying to do something where if the distance is lower than some threshold, I do stuff. I'm trying to use GeoPoint.Distance(), but it seems that the results are not in meters, contrary to what the documentation says ?

Here's a little test I did. Google Maps calculates ~161 meters, but the result I get is 0.2453885.
Here's the code :

GeoPoint p1 = new GeoPoint(48.114779, -1.670222);
GeoPoint p2 = new GeoPoint(48.114819, -1.668018);
Debug.Log($"Expected ~161 meters. Got {GeoPoint.Distance(p1, p2)}");

Maybe there's something I'm missing ?

Thanks in advance for your help !

Re: GeoPoint.Distance : result is not in meters ?

Hello.

The problem is in the order of the values in your coordinates.
They are in the Indian Ocean instead of France.

In Online Maps API, longitude comes first, then latitude.
https://infinity-code.com/documentation … pi---basic
Reverse the order of values and you get ~164 meters.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: GeoPoint.Distance : result is not in meters ?

Hi,

Thanks a lot, indeed for my tests that was wrong and that confused for the rest. Now I get it.

But I'll say this though, the distance is indeed not in meters, but in kilometers. Since with the correct order, I do not get ~161.0151 but ~0.1610151.

Thanks for your help though, have a great day.