15,611,422 members
See more:
I have a straight line, GPS coordinate "A" and GPS coordinate "B".
Looking for the method or code example that would allow me to extend the A - B vector by "X" (meters, yards, feet, whatever) to give me "Z".
Non graphic image here (best I can do :-) ):

Z--------A************************B

BTW - "Z" could be at either end of the known A - B points.
Example of coordinates I have: -116.63181685,32.71033345,0 -116.71756575,32.71401234,0

Help!

What I have tried:

Looked all over and everything I found basically gives me the distance between A - B.
Posted
Updated 23-Jan-21 19:01pm
v2

## Solution 2

Quote:
extend straight line using GPS coordinates

GPS coordinates means that you want distances on earth which is basically spherical.
To compute distance between 2 points, you need to define the great circle between those points.
Great circle - Wikipedia[^]
Great-circle distance - Wikipedia[^]
Point Z will be on same great circle.

CPallini 24-Jan-21 5:59am
5.
Patrice T 24-Jan-21 6:27am
thank you
Gary Paquette 25-Jan-21 12:09pm
Understood and thanks. On a short distance like a mile the spherical is not a big concern, typically would need to be ablow 12 miles.
So from a math / code perspective. How would I extend the line?
Patrice T 25-Jan-21 13:02pm
if you are near pole is a big concern even on small distance.
"How would I extend the line?"
I have not tried to solve this part.
Gary Paquette 25-Jan-21 22:58pm
We only fly within the continental USA. Only if Santa Clause needs help - that might change :-)

## Solution 1

Given you can work out the distance between A and B, you can then work out how to extend that vector by a certain distance. I've done the first bit, so this is basic maths to change it to do what you want

Gary Paquette 23-Jan-21 23:27pm
Hi Christian - where can I find your "first bit"?
Example of the coordinates: -116.63181685,32.71033345,0 -116.71756575,32.71401234,0
Which is five miles. If I want to extend 1 mile, what is the method?
Christian Graus 24-Jan-21 0:26am
The first bit is the algorithm you're using to find a distance between two lat/lng This is then just vector maths at that point. So if your two points are 2 miles and you want to add one mile, you need the vector point that's half as long again as the vector you have
CPallini 24-Jan-21 5:59am
5.