用户在地图上画一条线,并希望查找该线特定距离内的一些信息。
我有A and B地点位于“经纬度”格式,用户告诉我距离(A和A1之间的距离) in “米,公里,……”。
我该如何计算A1、A2、B1、B2地点位于“经纬度”格式?我正在使用 C# 并且坐标锐利 https://coordinatesharp.com用于处理位置。
PS:我读过this https://stackoverflow.com/questions/38807203/determine-a-bounding-rectangle-around-a-diagonal-line它适用于笛卡尔网格系统,但我无法针对我的问题调整其代码。
Having A
and B
坐标,您可以计算两个点的方位角(注意一般情况下方位角是不同的)。
带轴承Fi
恰到好处A
你可以计算轴承Fi - 90
and Fi + 90
,并在相应方位处找到所需距离处的点 A1 和 A2。
B1、B2也同样
您可以从以下位置获取公式Bearing and 给定目的地点距起点的距离和方位章节位于这一页 https://www.movable-type.co.uk/scripts/latlong.html
Bearing
θ = atan2( sin Δλ ⋅ cos φ2 , cos φ1 ⋅ sin φ2 − sin φ1 ⋅ cos φ2 ⋅ cos Δλ )
where φ1,λ1 is the start point, φ2,λ2 the end point
(Δλ is the difference in longitude)
目的地
φ2 = asin( sin φ1 ⋅ cos δ + cos φ1 ⋅ sin δ ⋅ cos θ )
λ2 = λ1 + atan2( sin θ ⋅ sin δ ⋅ cos φ1, cos δ − sin φ1 ⋅ sin φ2 )
where φ is latitude, λ is longitude, θ is the bearing
(clockwise from north), δ is the angular distance d/R;
d being the distance travelled, R the earth’s radius
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)