Cartopy中底图的npts功能的替代方法是什么?

时间:2019-05-31 12:30:18

标签: matplotlib-basemap cartopy proj

我想模拟basemap.Geod类中的ntps的功能。 其功能描述如下:

Given a single initial point and terminus point (specified by
        python floats lon1,lat1 and lon2,lat2), returns a list of
        longitude/latitude pairs describing npts equally spaced
        intermediate points along the geodesic between the initial and
        terminus points.

我想在Cartopy中做同样的事情,一种方法是计算每对连续坐标之间所需的距离,并使用该距离计算起点到终点的坐标。还有其他方法吗?

1 个答案:

答案 0 :(得分:0)

基于cartopy的来源,https://github.com/SciTools/cartopy/tree/master/lib/cartopy/geodesic ,显然ntps()中没有cartopy函数的等效项。

但是,如果您从端点之一知道方位角,则沿着测地线计算点的位置并不难。您可以按照以下步骤操作:

  1. 将Geodesic.inverse()与point1和2的(long,lat)输入配合使用,并获得(forward_bearing,backward_bearing,geodesic_dist)作为结果。
  2. 假设您要沿该测地线(以1为单位)获得一个点(长,纬度)(例如,整个距离的1/4),请对带有long1,lat1的Geodesic.direct()使用{{1 }}和forward_bearing

一个更好的选择是使用geodesic_dist/4并忘记以上所有内容。