开发者

Google MAP API v3: computeDistanceBetween method and distance in metric form

开发者 https://www.devze.com 2023-03-18 00:09 出处:网络
I want to calculate the direct distance between to p开发者_如何学Pythonositions in metric form. (ie: from A to B in kilometers).

I want to calculate the direct distance between to p开发者_如何学Pythonositions in metric form. (ie: from A to B in kilometers).

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

Thanks


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消