1
$\begingroup$

I am working on modifying GPS coordinates in Excel and I need to find the Latitude and Longitude (coordinates) of a point that is x metres away from the midpoint between the two coordinates. This point will always be perpendicular from the line between the two known coordinates, and the distance from the midpoint will always be known. I have attached an image of what I am trying to achieve. Being GPS of course will mean this "line" between the two known coordinates can be in any direction.

I found this question which is exactly the same basically but I could not get the answer to work because this field is not something I'm strong in.

If someone was able to show me how this is utilized by using my image as an example or if another way is thought of that would be amazing.

$\endgroup$
  • $\begingroup$ Do you always want to go to the right(down) or do you sometimes want to go to the left(up)? $\endgroup$ – Narlin Dec 27 '19 at 13:09
  • $\begingroup$ The method used here is not OK for long distances. It is totally a flat earth calculation. If you need long distances, then we have to use considerably more difficult ideas. This works fine over a few hundred miles, but no more. $\endgroup$ – Narlin Dec 27 '19 at 15:02
  • $\begingroup$ This will only be very small distances. The two points will never be more than 100m apart. Also yes the point I want can be on either side of the line (east and west). $\endgroup$ – Simon Dec 27 '19 at 18:07
  • $\begingroup$ I see what you mean about the $\Delta x,\,\Delta y$ of your example. I'm old. The picture is small and I needed glasses. $\endgroup$ – Narlin Dec 27 '19 at 21:32
0
$\begingroup$

You may find this too elementary, but 3rd grade arithmetic is what I do. While your points will work just fine in the method I want to show you, they are not good for demonstration because the change in x and the change in y are both equal to 6, which adds unneeded confusion. Let's use points. $A=(2,3)$ and $B=(5,7)$. Begin by defining a midpoint,P. $$P=\left(\frac{A_x+B_x)}{2},\frac{A_y+B_y}{2}\right)=\left(\frac{2+5}{2},\frac{3+7}{2}\right)=\left(3.5,5\right)$$ Next, we will define the change in x and change in y. $$\Delta x=B_x-A_x=5-2=3$$ $$\Delta y = B_y-A_y=7-3=4$$ We need to keep up with the sign of these numbers and always do the subtractions in the correct order. Now I am going to define a new number, n, which will be the distance in kilometers (whatever units) between the two points. $$n=\sqrt{\Delta x^2+\Delta y^2}=\sqrt{3^2+4^2}=\sqrt{25}=5$$ Now I will define a vector. This isn't difficult, so stay with me. These will be just numbers. $$v_{\perp}=\left(\begin{array}{c} \frac{-\Delta y}{n}\\ \frac{\Delta x}{n} \end{array}\right)=\left(\begin{array}{c} \frac{-4}{5}\\ \frac{3}{5} \end{array}\right)=\left(\begin{array}{c} -0.8\\ 0.6 \end{array}\right)$$ Incredibly, this vector tells us which direction to go away from the line and it will always be perpendicular to the line (either up or down, left or right). Finally, we are going to calculate the new postion, which we want to be 4 kilometers from the middle and at a right angle from the line between A and B. The $"\pm"$ in the equation below is because I don't know whether you are going left or right from the midpoint. Let $$d=4$$ $$\text{New Position }=P \pm d\cdot v_{\perp}$$ To show you how to do this calculation, I will write midpoint P as a vector.$$\text{midpoint}=P=\left(\begin{array}{c} 3.5\\ 5 \end{array}\right)$$ $$\text{New Position }=P \pm d\cdot v_{\perp}=\left(\begin{array}{c} 3.5\\ 5 \end{array}\right)\pm 4\cdot \left(\begin{array}{c} -0.8\\0.6\end{array}\right) $$ Doing the Plus part, $$\text{New Position }=\left(\begin{array}{c}3.5+4(-0.8)\\5+4(0.6)\end{array}\right)=\left(\begin{array}{c}3.5-3.2\\5+2.4\end{array}\right)=\left(\begin{array}{c}0.3\\7.4\end{array}\right)=(0.3,7.4)$$ Doing the Minus part, $$\text{New Position }=\left(\begin{array}{c}3.5-4(-0.8)\\5-4(0.6)\end{array}\right)=\left(\begin{array}{c}6.7\\2.6\end{array}\right)=(6.7,2.6)$$

$\endgroup$
  • $\begingroup$ Ahh thank you. This works a treat. I think I understand it. It confused me a bit using the x to get the y value and vice versa but I suppose that's due to the opposite gradient? Also just a FYI the change in my example is x=6,y=8. But that's all good. Also can't upvote your answer since I have less than 15 rep. $\endgroup$ – Simon Dec 27 '19 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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