开发者

Missing methods in Google Maps API v3. How can I emulate latRadians() and lngRadians()?

I need to calculate the latitude and longitude radians for 2 lat,lng points in a google maps by using api v3.

In api v2 they had th开发者_如何学Goese methods available: latRadians() and lngRadians()

How can I emulate that same functionality in api v3?

Long story short: I need to calculate the angle of a polyline in Google Maps API 3.


You can just extend for example google.maps.LatLng object to have your methods:

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

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


Conversion between radians and degrees is a well-known mathematical function:

  • radians = (π × degrees) / 180
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜