Why is Geopy Distance.Distance wrong?

From the Point GeoDjango Point field, I get the following points:

object1.point = "POINT(-113.4741271000000040 53.4235217000000020)"
object2.point = "POINT(-113.5013688000000229 53.5343457999999970)"

Then I calculate the distance with geopy:

from geopy import distance
from geopy import Point

p1 = Point("-113.4741271000000040 53.4235217000000020")
p2 = Point("-113.5013688000000229 53.5343457999999970")
result = distance.distance(p1,p2).kilometers
print result
# 5.791490830933827

But using this tool: http://www.movable-type.co.uk/scripts/latlong.html I get a distance of 12.45km

Why is there such a big mismatch?

+5
source share
1 answer

You have a lat / long wrong way. Try:

p1 = Point("53.4235217000000020 -113.4741271000000040")
p2 = Point("53.5343457999999970 -113.5013688000000229")

Gives me the result = 12.466096663282977

+9
source

All Articles