From 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 using 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 discrepancy?
You've got lat/long the wrong way round. Try:
p1 = Point("53.4235217000000020 -113.4741271000000040")
p2 = Point("53.5343457999999970 -113.5013688000000229")
Gives me result = 12.466096663282977
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With