添加数千个标记Google Map API V3 [英] Adding thousands of Markers Google Map API V3

查看:119
本文介绍了添加数千个标记Google Map API V3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在组合一个演示应用程序,需要在地图上显示28,000个标记,而不使用任何类型的群集。问题是,为地图添加标记的时间太长,导致浏览器崩溃!这里是当前进程

从数据库中提取包括LAT和LONG的地图点(不需要地理编码)
- 用于循环遍历每个返回值并执行此操作:

  var marker = new google.maps.Marker({
position:point,
动画:google.maps.Animation.DROP,
地图:地图,
标题:value.Title,
图标:图标['store']
});

google.maps.event.addListener(marker,'click',function(){
var hidingMarker = currentPlace;
var slideIn = function(marker){
$('#Name',info).text(place.Title);
$('#Phone',info).text(place.Description);
$('#Address', info).text(place.Proper_Address);
$('#LastSale',info).text(Last Sale:+ place.Last_Sale);
info.animate({right:'0 %'});
}

- 标记放入,用户可以点击他们中的任何一个人都可以看到一些信息。有没有一种更有效的方法来实现这一点,以便显示28,000个而不必将它们聚类在一起?我发现有些脚本是人们以前写的,但是它们都是用于api V2的,任何链接或者代码都非常感谢!
谢谢!

解决方案

根据我的经验,在地图上同时显示多个标记的唯一方法是使用融合表一些限制和其他需要解决的挑战)。所有其他用于处理这些标记的解决方案都涉及某种形式的聚类,或者不适用于广泛的缩放。



http://www.google.com/fusiontables/Home/


I am currently putting together a demo application that needs to show 28,000 markers on a map without using any type of clustering. The problem is, adding the marker to the map for that many takes so long that the browser crashes! Here is the current process

-Retrieves map points from database including LAT and LONG (doesn't have to geocode) - for loop cycles through each of the returned values and does this:

  var marker = new google.maps.Marker({
                 position: point,
                 animation: google.maps.Animation.DROP,
                 map: map,
                 title: value.Title,
                 icon: icons['store']
             });

             google.maps.event.addListener(marker, 'click', function () {
                 var hidingMarker = currentPlace;
                 var slideIn = function (marker) {
                     $('#Name', info).text(place.Title);
                     $('#Phone', info).text(place.Description);
                     $('#Address', info).text(place.Proper_Address);
                     $('#LastSale', info).text("Last Sale:" + place.Last_Sale);
                     info.animate({ right: '0%' });
                 }

-the markers drop in and the user can click on any of them to see a little bit of information

Is there a more efficient way to do this so that showing 28,000 would be possible without having to cluster them? I have found some scripts people wrote to handle it before, but they are all for api V2. Any links or code is greatly appreciated! thanks!

解决方案

In my experience, the only real way to show that many markers on the map at the same time is to use fusion tables (which does have some limitations and other challenges that need to be worked around). All other solutions for handling this many markers involve some form of clustering or will not work with wide zoom.

http://www.google.com/fusiontables/Home/

这篇关于添加数千个标记Google Map API V3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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