地理围栏算法

发布于 2024-09-02 13:14:33 字数 73 浏览 1 评论 0原文

给定一个点的纬度和经度。如何获得该点特定半径内的所有纬度和经度读数?是否有任何已知的方法来计算相对于给定点的半径内的所有纬度和经度?

Given the latitude and longitude of a point. How do I get all the readings of latitude and longitude with in a particular radius of that point? Is there any known method to calculate all latitudes and longitudes with in a radius with respect to a given point?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

绻影浮沉 2024-09-09 13:14:33

这种事情可以通过使用 R-Tree 有效地完成

This kind of thing can be done efficiently by using an R-Tree

2024-09-09 13:14:33

这将是非常非常大的纬度/经度!对于地理围栏,您要做的是计算距离(根据毕达哥拉斯)并根据距点的距离确定您是否在半径之外。

如果您想更进一步,您可以计算与 2 个点相交的线的距离。

我建议您查看此网站了解一些几何公式。

That would be a very very large number of lat/longs! For geofencing what you want to do is calculate the distance (as per pythagoras) and decide if you are outside the radius based on the distance from the point.

If you want to take it 1 step further you can calculate the distance from the line intersecting 2 points.

I suggest you have a look at this site for some geometry formulas.

梦与时光遇 2024-09-09 13:14:33

不可能获得给定点 500m 半径内的所有纬度/经度对(正如 @Cobusve 和我所指出的)——这样的对有无数个。您必须更准确地告诉我们您想要什么。

为了帮助您解决问题,我建议您拿一张您感兴趣的区域的地图,选择一个点并在其周围画一个半径为 500m 的圆。这将为您提供您所追求的所有要点,并可能表明您为什么需要更清楚。

顺便说一句,由于距离只有 500 米,我建议你在计算平面几何中的答案时忘记地球的近似球形。这种简化带来的任何不准确性都将非常非常小,并且它将极大地简化数学,我开始认为这对您有用。

It is not possible to get all the lat/long pairs within a 500m radius of a given point (as @Cobusve and I have pointed out) -- there is an infinite number of such pairs. You have to tell us more precisely what you want.

To help you work things out I suggest you take a map of the area you are interested in, choose a point and draw a circle of radius 500m around it. That will give you all the points you are after and perhaps suggest why you need to be more clear.

And, in passing, since the distance is only 500 metres I suggest you work out your answer, when you do, in plane geometry and forget the near-sphericity of the Earth. Any inaccuracies introduced by this simplification will be very very small and it will greatly simplify the mathematics and I am beginning to form the view that this will be useful to you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文