0

I want to emulate the function of ntps which is in basemap.Geod class. Its function is described as follows:

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.

I want to do the same thing in cartopy, aparantly one way is to calculate the distance needed between each pair of successive coordinate and use that distance to compute coordinates from start to end point. Is there any other way to do so?

1 Answers1

0

Based on cartopy's source, https://github.com/SciTools/cartopy/tree/master/lib/cartopy/geodesic , it is clearly that no equivalent of ntps() function is available from cartopy.

However, it is not difficult to compute locations of points along a geodesic if you know the bearing from one of the end point. Here are steps that you can follow:

  1. Use Geodesic.inverse() with input of (long, lat) of point1 and2, and get (forward_bearing, backward_bearing, geodesic_dist) as the result.
  2. Suppose you want to get (long, lat) of a point (say 1/4 of the whole distance) along that geodesic (in 1), use Geodesic.direct() with long1, lat1, the obtained forward_bearing and geodesic_dist/4.

A better alternative is to use pyproj and forget all the above.

swatchai
  • 17,400
  • 3
  • 39
  • 58