gpt4 book ai didi

javascript - Google Maps API v3 中缺少方法。我如何模拟 latRadians() 和 lngRadians()?

转载 作者:行者123 更新时间:2023-11-30 09:02:53 25 4
gpt4 key购买 nike

我需要使用 api v3 计算谷歌地图中 2 个纬度和经度点的纬度和经度弧度。

在 api v2 中,他们提供了这些方法:latRadians()lngRadians()

如何在 api v3 中模拟相同的功能?

长话短说:我需要在 Google Maps API 3 中计算折线的 Angular

最佳答案

例如,您可以扩展 google.maps.LatLng 对象以拥有您的方法:

google.maps.LatLng.prototype.latRadians = function()
{
return (Math.PI * this.lat()) / 180;
}

google.maps.LatLng.prototype.lngRadians = function()
{
return (Math.PI * this.lng()) / 180;
}

关于javascript - Google Maps API v3 中缺少方法。我如何模拟 latRadians() 和 lngRadians()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7786140/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com