learn-co-curriculum / nearest-neighbors-lab

Other
1 stars 28 forks source link

distance_location #23

Closed Jojanna closed 5 years ago

Jojanna commented 5 years ago

What are the units for the distance between pickup points for the "distance_location" function? The code suggests that the answer is ~0.235. The answer I come out with by implementing the haversine formula is 21.7 km. Using external calculators on the input lat/longs, my implementation appears to be correct. I do not know where 0.235 comes from - it is not in miles. Has something got muddled?

Jojanna commented 5 years ago

Pythagoras on lat/long?! Oh... I guess it's just an exercise! :(

mas16 commented 5 years ago

Hi Jojanna, the units for the distance are in decimal degrees like the lat/long coordinates. You are correct in pointing out that the precise distance must take into account the curvature of the surface of the earth using the haversine formula which this calculation does not.