两个经纬度查距离等叫反向
Geodesic.WGS84.Inverse(-41.32, 120.733523, 40.96, -5.50)
出发地经纬度加方位角和距离,查目的地经纬度叫正向
Geodesic.WGS84.Direct(30.773926, 126.25757, 0, 20000)
一开始觉得Geodesic.WGS84.Inverse得出的方位角奇怪,azi1与azi2差不多,35.7/36.3,这个方位角与我的理解不同,
注意43, 125.0与44, 126.0之间的连线没有问题,但125与126两条经线不是平行的,所以导致连线的方位角在两点不相同,
这里需要把连线当成矢量,azi1与azi2的大方向都是从1点出发朝2点的方向,不是我想的azi1时从1到2的方向,azi2是从2到1的方向。
后来我又颠倒了两个点的顺序,结果发现从1到2点的azi2 等于 从2到1点的azi1的180度反方向。
所以我可以用azi2+180表示反向的方位角。
Geodesic.WGS84.Inverse(43, 125.0, 44, 126.0)
{'lat1': 43, 'lon1': 125.0, 'lat2': 44, 'lon2': 126.0, 'a12': 1.2366466863602819, 's12': 137419.4495999654, 'azi1': 35.70945216023207, 'azi2': 36.39784223561479}
Geodesic.WGS84.Inverse(44, 126.0, 43, 125.0)
{'lat1': 44, 'lon1': 126.0, 'lat2': 43, 'lon2': 125.0, 'a12': 1.2366466863602819, 's12': 137419.4495999654, 'azi1': -143.6021577643852, 'azi2': -144.29054783976792}
另一个方法是通过角度和距离计算目标的经纬度:
Direct
(lat1, lon1, azi1, s12, outmask=1929)[source]
Solve the direct geodesic problem
Parameters: |
|
---|---|
Returns: |
Compute geodesic starting at (lat1, lon1) with azimuth azi1and length s12. The default value of outmask is STANDARD, i.e.,the lat1, lon1, azi1, lat2, lon2, azi2, s12, a12entries are returned.
Geodesic.WGS84.Direct(42.63055, 126.25757, 30, 100)
{'lat1': 42.63055, 'lon1': 126.25757, 'azi1': 30.0, 's12': 100, 'a12': 0.0008999523621324253, 'lat2': 42.63132960059242, 'lon2': 126.25817955704002, 'azi2': 30.00041283674731}
mrpoint = Geodesic.WGS84.Direct(42.63055, 126.25757, delta + theta, d)
gcj = wgs84togcj02(mrpoint['lon2'], mrpoint['lat2'])
GeographicLib API