使用VB.NET在地理路径长度上的差异 [英] Difference in geographic path length using VB.NET

查看:61
本文介绍了使用VB.NET在地理路径长度上的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个代码集来计算航线,从纬度/经度,初始方向,转弯方向,航迹长度,航迹宽度和行数开始。



所有变量都定义为十进制



使用135度和315度,100英里的轨道,我得到2个不同的结果。东南航道点相距100.5671英里,西北航点相距99.23002英里。这会使我的飞行线开始和结束偏斜,但是线路是平行的



在使用90/270标题进行测试时,如果使用更长的线路,那么lat / lon对似乎会导致标题的1.1度差异,但计算相同的路径长度和经度,但经度不同所以航线不平行



以下是公式


调用GetNextLineStart(EndLatRadians,EndLonRadians,TrackWidthKM,ConnectingCourseRadians)

LineStartLatDD = rad2deg(EndLatRadians)

LineStartLonDD = rad2deg( EndLonRadians)

LineCourseRadians = deg2rad(LineCourseDD)调用GetNextLineStart(EndLatRadians,EndLonRadians,TrackLengthKM,LineCourseRadians)

LineEndLatDD = rad2deg(EndLatRadians)

LineEndLonDD = rad2deg(EndLonRadians)







Sub GetNextLineStart(Lat1,Lon1,Dist,Course)

'拉特隆以弧度为单位,dist为km,当然是弧度

拨打GetNewlat(Lat1,Lon1,Dist,Course)

拨打GetNewlon(Lat1,Lon1,Dist,Course )

NewEndLatDD = RadToDeg(EndLatRadians)

NewEndLonDD = RadToDeg(EndLonRadians)



End Sub



和真正的肉



Sub GetNewlat(Lat1,Lon1,Dist,Bearing)

Dim R As Decimal = 6378.1

EndLatRadians = Math.Asin(Math.Sin(Lat1)* Math.Cos(Dist / R)+ Math.Cos(Lat1)* Math.Sin(Dist / R)* Math.Cos(轴承))

End Sub

Sub GetNewlon(Lat1,Lon1,Dist,Bearing)

Dim R当Decimal = 6378.1

EndLonRadians = Lon1 + Math.Atan2(Math.Sin(方位)* Math.Sin(Dist / R)* Math.Cos(Lat1),Math.Cos(Dist / R) ) - Math.Sin(Lat1)* Math.Sin(Lat1))

End Sub



我尝试过:



我将变量更改为十进制 - 无变化,

I have a code set that calculates flightlines, starting with a lat/lon, initial direction, turn direction, track length,track width And line count.

All variables are defined as decimal

Using 135 degrees and 315 degrees, 100 mile track, I get 2 different results. The southeast course points are 100.5671 miles apart, and the Northwest points are 99.23002 miles apart. This skews my flight lines start and ends, but the lines are parallel

In testing with 90/270 headings, with longer lines, the lat/lon pairs seem to cause a 1.1 degree variance in headings, but calculate to the same path lengths and longitudes, but differing longitudes so the flight lines are not parallel

Here are the formulas

Call GetNextLineStart(EndLatRadians, EndLonRadians, TrackWidthKM, connectingCourseRadians)
LineStartLatDD = rad2deg(EndLatRadians)
LineStartLonDD = rad2deg(EndLonRadians)
LineCourseRadians = deg2rad(LineCourseDD)Call GetNextLineStart(EndLatRadians, EndLonRadians, TrackLengthKM, LineCourseRadians)
LineEndLatDD = rad2deg(EndLatRadians)
LineEndLonDD = rad2deg(EndLonRadians)

And

Sub GetNextLineStart(Lat1, Lon1, Dist, Course)
' lat lon in radians, dist in km, course in radians
Call GetNewlat(Lat1, Lon1, Dist, Course)
Call GetNewlon(Lat1, Lon1, Dist, Course)
NewEndLatDD = RadToDeg(EndLatRadians)
NewEndLonDD = RadToDeg(EndLonRadians)

End Sub

And the real meat

Sub GetNewlat(Lat1, Lon1, Dist, Bearing)
Dim R As Decimal = 6378.1
EndLatRadians = Math.Asin(Math.Sin(Lat1) * Math.Cos(Dist / R) + Math.Cos(Lat1) * Math.Sin(Dist / R) * Math.Cos(Bearing))
End Sub
Sub GetNewlon(Lat1, Lon1, Dist, Bearing)
Dim R As Decimal = 6378.1
EndLonRadians = Lon1 + Math.Atan2(Math.Sin(Bearing) * Math.Sin(Dist / R) * Math.Cos(Lat1), Math.Cos(Dist / R) - Math.Sin(Lat1) * Math.Sin(Lat1))
End Sub

What I have tried:

I changed the variables to decimal- no change,

推荐答案

您似乎正在使用球形模型,这对于低精度计算是可以的。

我怀疑你得到有趣结果的根本原因是你在计算你线路一端的隐式经度比例系数(纬度的余弦)。

全部有关lat / lon计算的其他反直觉的东西。例如,一般来说,从A到B的轴承通常与从B到A的轴承不是180度不同。

当你使用更逼真的椭圆体模型时,事情变得更加复杂(像GPS使用)。如果你想看看它是如何真实的话,请从 ICSM - GDA技术手册 [ ^ ]
You appear to be using a spherical model, which is OK for low accuracy calculations.
I suspect the fundamental reason you get funny results is that you are calculating the implicit longitude scaling factor (cosine of latitude) at one end of your line.
There are all sorts of other counter-intuitive things about lat/lon calculations. For example, in general the bearing from A to B is in general, NOT 180 degrees different to the bearing from B to A.
And things get even more complicated when you use a more realistic ellipsoidal model (like GPS uses). If you want to see how it really words, start somewhere like ICSM - GDA Technical Manuals[^]


这篇关于使用VB.NET在地理路径长度上的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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