Monday, June 3, 2024
191
rated 0 times [  193] [ 2]  / answers: 1 / hits: 18310  / 13 Years ago, wed, july 6, 2011, 12:00:00

I want to calculate the direct distance between to positions in metric form. (ie: from A to B in kilometers).



I didn't understand what computeDistanceBetween method returns in units.



Thanks


More From » google-maps-api-3

 Answers
8

It's in meters. To convert to kilometers divide by 10241000, obviously.



google.maps.geometry.spherical.computeDistanceBetween(
Moscow, Leningrad
); // 679601 m


By the way, the underlying code of this library method is based on the Haversine formula.


[#91324] Tuesday, July 5, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
shantelc

Total Points: 737
Total Questions: 120
Total Answers: 104

Location: Nicaragua
Member since Tue, Dec 8, 2020
4 Years ago
;