Reputation: 31
I run the geopy.distance.vincenty()
function of Python in the same coordinates, one time in degrees and then in radians and I get completely different results.
print(geopy.distance.vincenty((0.88802*180.0 / math.pi, 0.0780654*180.0 / math.pi),
(0.888019*180.0 / math.pi, 0.0780669*180.0 /math.pi )).m)
I get 8.787072619249342
and when I do it in radians
print(geopy.distance.vincenty((0.88802, 0.0780654), (0.888019, 0.0780669)).m)
I get 0.2002536292651726.
Upvotes: 1
Views: 746
Reputation: 8122
The function is expecting values in degrees, so the first result is correct. You'll get the same answer if you convert the second set of coordinates to degrees, e.g. with math.degrees()
or np.degrees()
:
import numpy as np
geopy.distance.vincenty((np.degrees((0.88802, 0.0780654)),
np.degrees((0.888019, 0.0780669)).m
)
I'm looking at the example in the documentation, and also at the code. (By the way, note that it says vincenty()
is deprecated.)
Upvotes: 1