I have two coordinates of locations on the earth and want to calculate points in between these two coordinates on the Beeline, for example the coordinate in the middle or at 10%.

I am able to do this on a plane. However, I am not sure how to do this on a spheroid or ellipsoid. It doesn't need to be 100% accurate, but the planar version is definitely not good enough.

As asked by Ian Turton, I tried a planar formula, in Java this could look like this (taken from jts):

  public Coordinate pointAlong(double segmentLengthFraction)
    Coordinate coord = new Coordinate();
    coord.x = p0.x + segmentLengthFraction * (p1.x - p0.x);
    coord.y = p0.y + segmentLengthFraction * (p1.y - p0.y);
    return coord;

I had a look at JTS as well, but I could only find a planar (LineSegment#pointAlong) version for this, not sure if they offer a different version?

  • what language are you using? what have you tried so far?
    – Ian Turton
    Jul 3, 2019 at 9:35
  • @IanTurton as mentioned in the question, I tried for example LineSegment#pointAlong, which uses a planar approach. I am using Java, but I am not necessarily looking for a language specific solution. I am looking for an algorithm or formula. That's why I didn't mention any language specifics and did not add any language specific tags. A solution in Java would be fine for me, but a general formula would be great as well.
    – Robin
    Jul 3, 2019 at 10:32
  • I added a code example @IanTurton, but I am not sure if this improves the question, as this is obviously not the correct approach?
    – Robin
    Jul 3, 2019 at 10:36
  • 1
    Robin have you tried geograpiclib, which has code for geodesics on an ellipsoid?geographiclib.sourceforge.io/2009-03/geodesic.html
    – Hans Erren
    Jul 3, 2019 at 10:37
  • @HansErren this looks really promising, I will have a look thanks!
    – Robin
    Jul 3, 2019 at 10:49

1 Answer 1


The open source library geograpiclib has code for geodesics on an ellipsoid in various programming languages https://geographiclib.sourceforge.io/2009-03/geodesic.html

Main page: https://geographiclib.sourceforge.io/

Resource page for

    * C. F. F. Karney, Transverse Mercator with an accuracy of a few nanometers, J. Geodesy 85(8), 475–485 (Aug. 2011); preprint arXiv:1002.1417; addenda.

    * C. F. F. Karney, Geodesics on an ellipsoid of revolution, arXiv:1102.1215 (Feb. 2011).

    * C. F. F. Karney, Algorithms for geodesics, J. Geodesy 87(1), 43–55 (Jan. 2013); DOI: 10.1007/s00190-012-0578-z; addenda.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.