Python – Interpolating Orthodrome Between Two (lon, lat) Points

great circlepython

I have a polygon that consists of a few (lon, lat) points, each pair of consequent points is considered to be connected by orthodromes. I want to interpolate the polygon with some extra points between each source point pair (add some more waypoints lying on the orthodrome).

I know, that geopy, for example, has the possibility to calculate the distance on great circle, but I need some more: to find the waypoints on great circle.

I need something like that:

src_lon = 10
src_lat = 40

dst_lon = 20
dst_lat = 60

n_points = 100

lons, lats = interpolate_orthodrome(src_lon, src_lat, dst_lon, dst_lat, n_points)

Best Answer

I have found a good solution:

pyproj.Geod.npts:

from pyproj import Geod


lon0, lat0 = 10, 10
lon1, lat1 = 20, 20
n_extra_points = 100    

geoid = Geod(ellps="WGS84")
extra_points = geoid.npts(lon0, lat0, lon1, lat1, n_extra_points)
  • List item