Ankush Rathi
Ankush Rathi

Reputation: 620

Geopy distance between locations

I am using geopy for calculating distance between two locations.

from geopy.distance import distance
loc1 = (41.49008, -71.312796)
loc2 = (41.499498, -81.695391)
dist = distance(loc1,loc2).miles
print dist

this gives an output

538.390445157

But I just wanted to tally if the geopy calculations were close enough to google maps or not. So I checked it on google maps and its saying

638 miles

for the same locations.

How do I fill the difference? Any suggestions? Thank you.

Upvotes: 1

Views: 2723

Answers (1)

Mike Müller
Mike Müller

Reputation: 85442

geopy calculates the straight-line distance while the 638 miles from Google maps is for traveling on roads. The 638 miles are for a route via I-80 W. Taking I-90 W, you need to drive 667 miles.

Upvotes: 2

Related Questions