简体   繁体   English

如何使用Openlayers从经度和纬度获取角度

[英]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. OpenLayers是完全免费的开放源代码JavaScript,可轻松在任何网页中放置动态地图。 I am using Openlayers in my project. 我在我的项目中使用Openlayers。 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. 使用OpenLayers,我可以得到经度和纬度,但是我想从Openlayers获得角度。

So is there any API available in OpenLayer which converts the lat and long to angle. OpenLayer中是否有可用的API将经纬度转换为角度。 I did try to find API in the openlayers "Util" section but was not able to get it. 我确实尝试在openlayers“ Util”部分中找到API,但无法获取它。

ofcourse there are many math functions which can do that but I am curious to get it through Openlayers only. 当然,有许多数学函数可以做到这一点,但我很好奇只能通过Openlayers获得它。

You can extend feature.geometry or write util function for angle calculation, for example: 您可以扩展feature.geometry或编写util函数进行角度计算,例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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