在地图上动态加载标记在谷歌地图上移动/拖动/平移 [英] Loading markers on google maps dynamically on map move/drag/pan

查看:269
本文介绍了在地图上动态加载标记在谷歌地图上移动/拖动/平移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在Google地图上显示一组标记。另外,我需要显示额外的标记,当用户拖动地图时,会动态加载。



标记的数量可能为数千,其中30-50需要最初显示。其他标记只有当用户在包含标记的区域上方平移时才需要加载和显示。我想过使用标记管理器,但我不确定是否可以将标记动态添加到标记管理器。我想要更类似于这个地图。请注意,当您平移地图时进行图像加载,并在您平移时收集垃圾。



标记群集并不重要,但可能会很好。

解决方案

我正在对数千个标记数据集进行聚类。我是这么做的:当'moveend'事件被触发时,我得到了地图的边界并发送一个ajax请求到服务器。我从您的数据库中获取标记并将其发送回客户端。如果您对流程的特定部分有疑问,请告诉我。



另外,使用标记管理器,我相信您可以动态添加标记。 p>

I need to display a set of markers on a google map. In addition, I need to show additional markers, loaded dynamically, when the user pans the maps.

The number of markers could be in thousands, out of which 30-50 need to be displayed initially. Other markers need to be loaded and displayed only when user pans over an area that contains markers. I thought about using marker managers but i am not sure if markers can be fed to the marker manager dynamically. I want something more like this map. Notice how images load when you pan the map and garbage-collected when you pan away.

Marker clustering is not important but might be nice.

解决方案

I am doing this with clustering on a dataset of several thousand markers. This is how I'm doing it: When the 'moveend' event is fired, I get the bounds of the map and send an ajax request to the server. I get the markers from your DB which are in the bounds and send them back to the client. If you have questions about a specific part of the process, just let me know.

Also, with the Marker Manager, I believe that you can add markers dynamically.

这篇关于在地图上动态加载标记在谷歌地图上移动/拖动/平移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆