如何使用 R-Tree 在谷歌地图上绘制大量地图标记

发布于 2024-09-05 17:10:23 字数 303 浏览 7 评论 0原文

在搜索了SO和多篇文章后,我还没有找到解决我的问题的方法。

我想要实现的是在 Google 地图上加载 20,000 个标记。

R-Tree 似乎是一个很好的方法,但它仅在搜索点内有帮助地图的可见部分。当地图缩小时,它将返回所有点并......使浏览器崩溃。

拖动地图以及拖动结束时重新运行查询也存在问题。

我想知道如何使用 R-Tree 并能够实现上述所有目标。

After searching SO and multiple articles I haven't found a solution to my problem.

What I am trying to achieve is to load 20,000 markers on Google Maps.

R-Tree seems like a good approach but it's only helpful when searching for points within the visible part of the map. When the map is zoomed out it will return all of the points and...crash the browser.

There is also the problem with dragging the map and at the end of dragging re-running the query.

I would like to know how I can use R-Tree and be able to achieve the all of the above.

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

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

发布评论

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

评论(2

时光与爱终年不遇 2024-09-12 17:10:23

如前所述,当您查看缩小的视图时,R-Tree 不会为您提供帮助。这个问题通常可以通过标记聚类来解决,因为在浏览器窗口中显示 20,000 个点并没有多大用处。

标记管理器是一个开源 JavaScript 库它解决了这个问题,但还有其他的。

由于标记数量非常多,您可能需要查看服务器端聚类(其中 R-Tree 可能会派上用场!)。 此处 是对此的一次讨论,其 Google 缓存,因为在撰写本文时链接已失效。

As noted, R-Tree won't help you when you're looking at a zoomed-out view. This problem is often addressed by marker clustering, because showing 20,000 points in a browser window isn't that useful.

Marker Manager is an open source javascript library which addresses this, but there are others.

With a very great number of markers, you may need to look at server-side clustering, (where R-Tree may come in handy!). Here is one discussion of it, and its google cache because link is dead at time of writing.

魂归处 2024-09-12 17:10:23

如果您不想为聚类而烦恼,那么只需将标记列表终止于预设数量,也许是几百个(您可以通过可用性测试来确定),并显示一些指示,表明当您放大时有更多可用的标记

If you don't want to bother with clustering, then just terminate your marker list at a preset number, maybe a few hundred (which you can determine by usability testing), and display some indication that there are more available as you zoom in

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