开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜