给定初始坐标和*小*范围计算新的 GPS 坐标
我试图弄清楚如何计算 GPS 坐标的特定给定范围内的最小/最大纬度/经度界限。
例如: gps 坐标 37.42935699924869,-122.16962099075317 范围 0.2 英里
我正在查看 http://www.movable-type.co.uk/scripts/latlong.html 网站,但我不确定这是否正是我想要的。
这给出了 4 个独特的纬度/经度对,我想要/需要一个最大/最小纬度和一个最大/最小长度。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好吧,给定一个点和一个距离,你会得到一个圆。
您正在寻找两个点,它们本质上描述了一个正方形(两个相对的角)。您要寻找的两个点甚至不在圆上。我不太清楚你为什么想要这个,但我认为你的问题没有答案。
也许您可以告诉我们您想要实现什么目标。
编辑:添加图像来说明。橙色线是距中心的距离(例如 0.2 英里)
alt text http:// img155.imageshack.us/img155/1315/diagramp.png
Well, given a point and a distance, you will get a circle.
You're looking for two points, which will essentially describe a square (two opposite corners). The two points you're looking for won't even be on the circle. I'm not exactly sure why you want this, but I don't think there is an answer to your question.
Perhaps you could tell us what you're trying to accomplish.
EDIT: Added image to illustrate. The orange line is the distance from the centre (e.g. 0.2 miles)
alt text http://img155.imageshack.us/img155/1315/diagramp.png
在您澄清之后,这是一个不太优雅的答案,可能会给您带来您想要的东西。好吧,你想要一个非常复杂的函数的反函数。恐怕我的数学能力无法胜任这项任务,但它应该是可行的。
一个不太优雅的解决方案是通过反复试验来找到它。本质上,保持经度相同并改变纬度。使用正确的算法,您应该能够找到一个非常接近您想要的距离的算法。这将为您提供圆上的一个点(也在正方形上的四个点之一)。
然后保持纬度相同并改变经度。这将为您提供正方形上的第二个点(在一侧的中间),从那里您可以找到正方形的 4 个角。
这会减慢速度,具体取决于您需要执行此操作的频率,这可能重要也可能无关紧要。
After your clarification, here is a less elegant answer that might give you what you want. Well, you want the inverse of a really complicated function. I'm afraid my math skills aren't up to the task, but it should be doable.
A less elegant solution is to find it by trial and error. Essentially, keep longitude the same and vary latitude. Using the right algorithm, you should be able to find one that is very close to the distance you want. This will give you a point on the circle (one of four that is also on the square).
Then keep latitude the same and vary longitude. This will give you a second point on the square (on the middle of one of the sides), from there you can find the 4 corners of the square.
This will slow, depending on how often you have to do it, that might or might not matter.