简体   繁体   English

Google Maps API V3-先加载地图,然后加载标记

[英]Google Maps API V3 - Load map first and then load markers

I am creating a page to show a list of locations(markers) on Google maps. 我正在创建一个页面,以显示Google地图上的位置(标记)列表。 The number of markers is dynamic and can be quite large. 标记的数量是动态的,并且可能很大。 This will adversely affect user experience when the map ( along with the markers ) are taking too long to load. 当地图( 以及标记 )加载时间过长时,这会对用户体验产生不利影响。

Can anyone point me in the right direction to load the map first and then load the markers. 谁能指出我正确的方向,以便先加载地图,然后加载标记。 Any help much appreciated. 任何帮助,不胜感激。

Use a marker manager. 使用标记管理器。 I used one for Google Maps API v2 (for on-demand loading of ~2000 markers via AJAX) and I am sure there's one for API v3. 我为Google Maps API v2使用了一个(用于通过AJAX按需加载约2000个标记),并且我确定有一个API v3。 A marker manager is class that allows you to selectively display markers on a Google Map. 标记管理器是一个类,可让您有选择地在Google Map上显示标记。 Instead of adding markers to map, you use add them to the marker manager and it takes care of when and how to display the markers. 无需添加标记到地图,而是使用将它们添加到标记管理器,它可以照顾何时以及如何显示标记。 The markers that lie outside the "visible" region are removed hence its fairly memory efficient. 位于“可见”区域之外的标记将被删除,因此其存储效率相当高。 A marker manager class may provide "clustering" option (or may be you need another class for this). 标记管理器类可以提供“聚类”选项(或者您可能需要另一个类)。 A cluster manager displays one marker that encompasses multiple markers when markers are too close, specially at high zoom level. 当标记过于靠近时(特别是在高缩放级别时),集群管理器会显示一个包含多个标记的标记。 Hope this helps you in the right direction. 希望这可以帮助您朝正确的方向发展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM