赤道上的方位角等于非赤道上的方位角吗? [英] Is the Azimuth on the equator equal to the one not on the equator?

查看:193
本文介绍了赤道上的方位角等于非赤道上的方位角吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图完全理解方位角的概念,并且遇到一些不一致的地方(或者也许是我的错误).

I am trying to fully understand the concept of Azimuth and I am encountering some inconsistencies (or maybe it is my error).

我向您展示了一些不匹配的示例,希望有人可以向我解释这是如何工作的.

I show you some examples that do not match, hoping somebody can explain me how this really works.

我使用自己的JavaScript函数在PostGIS中的EPSG:900913中显示坐标.

I show the coordinates in EPSG:900913, in PostGIS and using my own JavaScript function.

我的功能

/* Difference between the two longitudes */
var dLon = lon2 - lon1;
/* Y value */
var y = Math.sin(dLon) * Math.cos(lat2);
/* X value */
var x = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(dLon);
/* Calculates the azimuth between the two points and converts it to degrees */
var angle = Math.atan2(y, x) / Math.PI * 180;

示例

/* Same Y, not on the equator */
Point A: (-81328.998084106, 7474929.8690234)
Point B: (4125765.0381464, 7474929.8690234)
Result in PostGIS: 90 degrees
Result in my JS function: 74.232 degrees

/* Same Y, on the equator */
Point A: (-81328.998084106, 0)
Point B: (4125765.0381464, 0)
Result in PostGIS: 90 degrees
Result in my JS function: 90 degrees

我了解到,在赤道上,水平线的方位角为90(或270).认为如果在赤道北(或南)一点处画一条水平线,那么方位角就不再是90度了.但是... PostGIS告诉我,当我们具有相同的Y时,它总是90度.

I understand, that on the equator, the Azimuth is 90 (or 270) for a horizontal line. think that if you draw a horizontal line a bit North (or South) of the equator, then the Azimuth is not 90 degrees anymore. But... PostGIS tells me that it is always 90 degrees when we have the same Y.

此外,此计算器还显示了水平线的方位角当Y!= 0时(不是在赤道上)不是90度.

Additionally, this calculator also show that the Azimuths of horizontal lines are not 90 degrees when Y != 0 (not on the equator).

它正确吗?

谢谢

推荐答案

在您的示例中,您使用了EPSG:900913,它是平面的,投影的并且以米为单位.这意味着所使用的公式将为atan2,当纬度相同时,它将始终为90,因为公式为:

In your example you have used EPSG:900913, which is planar, projected and in meters. This means that the formula used will be the atan2, which will always be 90 when the latitudes are the same, as the formula is:

azimuth = atan2(y1-y2, x1-x2)

第二部分将始终为0,方位角为90.因此,使用平面坐标,是的,对于纬度相同的坐标对,方位角将始终相同,这就是为什么Postgis始终给出相同答案的原因使用EPS:900913时.

And the 2nd part will always be 0, giving an azimuth of 90. So, using planar coordinates, yes, the azimuth will always be the same for pairs of coordinates with identical latitudes and this is why Postgis always gives the same answer when using EPS:900913.

如果切换到地理数据类型,因此使用大地坐标,则不再是这种情况.

If you switch to the geography datatype, and therefore use geodesic coordinates, this is no longer the case.

例如:

select degrees(   
  st_azimuth(
   st_makepoint(0, 10)::geography, 
   st_makepoint(90, 10)::geography));

在Postgis中给出80.1318065,并在您链接的计算器页面上给出80.139.

Gives 80.1318065 in Postgis and gives 80.139 on the calculator page you linked.

对于给定的纬度,随着x/经度越靠近,值越接近90.例如

As the x/longitudes get closer together, the closer the values get to 90, for a given latitude. For example,

select degrees(   
  st_azimuth(
   st_makepoint(0, 10)::geography, 
   st_makepoint(1, 10)::geography));

现在在Postgis中给出89.9131737,在在线计算器中给出89.333(略有差异).

Now gives 89.9131737 in Postgis and and 89.333 in the online calculator (slightly more discrepancy).

所有这些都是由于公式现在考虑了曲率,因此,除了在赤道上,两个具有相等纬度的向量的投影之间的夹角将不再是90度.

All of this is due to the fact that the formula now accounts for curvature, so the angle between the projections of the two vectors with equal latitude will no longer be 90, except on the equator.

请参见 Wikipedia方位角文章中的等式.这应该很容易用JavaScript编写代码,并且应该为具有地理类型的Postgis提供类似的答案.

Look at the equation in the Wikipedia azimuth article for the spheroid version. That should be easy enough to code up in JavaScript and that ought to give comparable answers to Postgis with the geography type.

这篇关于赤道上的方位角等于非赤道上的方位角吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆