Question

How to find a few coordinates that are in the straight line, between 2 coordinates?

For example:

Start coordinate: Lat=X1 Long=Y1

End coordinate: Lat=X2 Long=Y2

Make a straight line from X1,Y1 to X2,Y2.

Then find 5 points that are located in that line, that are spread in the same distance.

Anyone can help to find the algorithm and calculation?

The coordinate is in decimal format, e.g. 50.123456, 6.123456

Thanks.

Was it helpful?

Solution

There are no "straight lines" on a sphere (or ellipsoid).

Anyway, you'll need to:

  1. Calculate the distance and initial azimuth from (x1,y1) to (x2,y2).

    You can use Vincenty's inverse method.

  2. Calculate the coordinate of points with distance (0,25d, 0.5d, 0.75d) from (x1,y1) at that azimuth (plus points (x1,y1) and (x2,y2) of course).

    You can use Vincenty's direct method.

Both direct and inverse methods are described on Wikipedia.

An extremely accurate implementations for both direct and inverse problems are available as part of GeographicLib.

Less accurate, but much simpler methods are described in Aviation Formulary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top