Google Maps API,Marker Clusterer限制

时间:2014-04-03 16:45:04

标签: javascript google-maps google-maps-api-3 markerclusterer

因此,我使用Google Maps API / Marker Clusterer难以理解文件大小限制;整个页面的代码。这适用于大约10000条记录的JSON文件(下面的代码执行),但是当我超过该限制时,说一个15000的JSON文件,下面的代码停止工作。不会生成任何标记/群集(如果是浏览器性能问题,我会等待)。任何想法?

<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="platform1.json"></script>
<script type="text/javascript" src="markerclusterer.js"></script>

<script type="text/javascript">

  function initialize() {

    var center = new google.maps.LatLng(36.597889,9.492188);
    var map = new google.maps.Map(document.getElementById('map'), {zoom: 3,center: center});

    var markers = [];

    for (var i = 0; i < 10500; i++) {
      var dataGeo = data.geo[i];
      var latLng = new google.maps.LatLng(dataGeo.LatAdj,dataGeo.LongAdj);
      var marker = new google.maps.Marker({position: latLng,title: dataGeo.Title,org: dataGeo.Organisation});

      var infowindow = new google.maps.InfoWindow({content: " "});
      google.maps.event.addListener(marker, 'mouseover', function() {
      infowindow.setContent('<div class="mapTitle">'+this.title+", "+this.org+'</div>');
      infowindow.open(map, this);});

      markers.push(marker);
    }

    var markerCluster = new MarkerClusterer(map, markers);
  }

  google.maps.event.addDomListener(window, 'load', initialize);
</script>

0 个答案:

没有答案