简体   繁体   中英

How to get angle from longitude and latitude using Openlayers

OpenLayers is completely free, Open Source JavaScript which makes it easy to put a dynamic map in any web page. I am using Openlayers in my project. Here is the problem which I am facing in it:

Using OpenLayers I am able to get Longitude and Latitude but I want the angle from the Openlayers.

So is there any API available in OpenLayer which converts the lat and long to angle. I did try to find API in the openlayers "Util" section but was not able to get it.

ofcourse there are many math functions which can do that but I am curious to get it through Openlayers only.

You can extend feature.geometry or write util function for angle calculation, for example:

OpenLayers.Util.angle = function (x, y) {
    return Math.tan(y/x);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM