如何按给定方向和长度缩放 GPS 坐标
我想按给定的方向和长度缩放 GPS 坐标。 例如我有两点A,B。我知道他们的 GPS 位置(也是笛卡尔格式),我想将 AB 线的长度更改 1.5,其中 A 点应该完好无损,B 点应该移动到新位置 B'
有什么想法吗?
I'd like to scale GPS coordinate by given direction and length.
E.g. I have two points A,B. I know their GPS position (also in cartesian format) and I'd like to change the length of line AB by 1.5 where point A should be intact and B should move to new position B'
any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否理解你的问题。您是否想要计算位于两个已知点 A 和 B 之间的直线上但位于该直线上 B 后面 A 和 B 之间距离一半的位置?
计算 A 和 B 之间的矢量差:如果 A 的坐标为 latA、lonA,B 的坐标为 latB、lonB,则差值 L = BA 的坐标为 latL = latB-latA,lonL = lonB-lonA。
您要查找的点的坐标为 latA + 1.5 * latL 和 lonA + 1.5 * lonL。
这使用穿过 A 和 B 的直线表示为 X = A + l * (BA);所有满足矢量方程的点 X 都在线上。
当然,这假设采用笛卡尔坐标系。不过,对于短距离来说,结果应该还可以。
I am not sure if I understand your question. Do you want to compute a location which is on the line between two known points A and B but half the distance between A and B behind B on that line?
Compute the vector difference between A and B: if A has coordinates latA, lonA, and B has coordinates latB, lonB than the difference L = B-A has coordinates latL = latB-latA and lonL = lonB-lonA.
The point you are looking for than has coordinates latA + 1.5 * latL, and lonA + 1.5 * lonL.
This uses the representation of the line passing through A and B as X = A + l * (B-A); all the points X satisfying the vector equation are on the line.
Of course this assumes a Cartesian coordinate system. However, for short distances the result should be ok.