私は Azimuth の概念を完全に理解しようとしていますが、いくつかの矛盾に遭遇しています (または、私のエラーかもしれません)。
一致しない例をいくつか示します。これが実際にどのように機能するかを誰かが説明してくれることを願っています。
EPSG:900913、PostGIS、および独自の JavaScript 関数を使用して座標を表示します。
私の機能
/* 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 度であると教えてくれます。
さらに、この計算機は、Y != 0 (赤道上ではない) の場合、水平線の方位角が 90 度ではないことも示しています。
どのように正しいですか?
ありがとう