[Python] How to interpolate circle arc with lines on Earth surface?

Discussão em 'Python' iniciado por Stack, Abril 16, 2025.

  1. Stack

    Stack Membro Participativo

    I have the coordinates (lat, lon) of 3 points (P0, P1, P2) on the Earth surface. The distance between P1 and P0 is the same as the distance between P2 and P0. Therefore, one can make a circle arc from P1 to P2 with P0 as a centre. My problem is that I need to interpolate this circle arc by N lines to be able to work with it in the GeoJSON format (which does not support circles/circle arcs). Each line segment should ideally have the same legth.

    Is there any library suitable for this problem? I have found some code for transformation of a circle to a polygon (such as polycircles), but none of them seemed to support circle arcs.

    A simple code is here:

    import geopy.distance

    # DME OKL: 50 05 45.12 N 14 15 56.19 E
    lon0 = 14.265608
    lat0 = 50.095867
    coords0 = (lat0, lon0)

    # 1st circle point: 50 03 10,23 N 014 28 30,47 E
    lon1 = 14.475131
    lat1 = 50.052842
    coords1 = (lat1, lon1)

    # 2nd circle point: 49 59 33,96 N 014 24 58,76 E
    lon2 = 14.416322
    lat2 = 49.992767
    coords2 = (lat2, lon2)

    # verification of dinstances:
    print(geopy.distance.distance(coords1, coords0).nautical)
    print(geopy.distance.distance(coords2, coords0).nautical)

    # How to interpolate circle arc between points 1 and 2?

    Continue reading...

Compartilhe esta Página