2013-08-21 131 views
0

我有我正在使用羣集這樣谷歌地圖與簇不工作

script src="http://www.google.com/jsapi"></script> 
    <script type="text/javascript"> 
     var script = '<script type="text/javascript" src="js/cluster'; 
     if (document.location.search.indexOf('compiled') !== -1) { 
     script += '_compiled'; 
     } 
     script += '.js"><' + '/script>'; 
     document.write(script); 
    </script> 

    <script type="text/javascript"> 

     google.load('maps', '3', { 
     other_params: 'sensor=false' 
     }); 
     google.setOnLoadCallback(initialize); 
     function initialize() { 
     var GPS = <%=GPS %> 
     var map_center = new google.maps.LatLng(31.2330555556,72.3330555556); 
     var map = new google.maps.Map(document.getElementById("map"), { 
      zoom: 6, 
      center: map_center, 
      mapTypeId: google.maps.MapTypeId.ROADMAP 
     }); 
     var infowindow = new google.maps.InfoWindow(); 
      if (markerClusterer) { 
      markerClusterer.clearMarkers(); 
     } 
     var markers = [];  
     for(i=0; i<GPS.length; i++) 
     { 
     var markerImage = new google.maps.MarkerImage(imageUrl, 
      new google.maps.Size(24, 32)); 
     var imageUrl = 'ico/' + GPS[i].ICON;   
      markers[i] = new google.maps.Marker({ 
      position: GPS[i].GPS, 
      draggable: true, 
      icon: markerImage, 
      Info: '<table frame=box><tr><td align="Left"><font face="Arial" size=2 color=#336699>Shop Name:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].SHOP + '</font></td></tr><tr>'+ 
      '<td align="Left"><font face="Arial" size=2 color=#336699>Owner:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].OWNER + '</font></td></tr>'+ 
      '<td align="Left"><font face="Arial" size=2 color=#336699>Mobile:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].MOBILE + '</font></td></tr>'+ 
      '<tr><td align="Left"><font face="Arial" size=2 color=#336699>Distributer:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].DIST + '</font></td></tr><tr>'+ 
      '<tr><td align="Left"><font face="Arial" size=2 color=#336699>Region:</td><td align="Left"><font face="Arial" size=2>'+ GPS[i].REGION + '</font></td></tr>'+ 
      '<tr><td align="Left"></td><td align="Left"><font face="Arial" size=2 color=#336699><a target=_blank href=http://221.120.216.52/elp/sfpl/sfpl.php?ccode=01&amp;&regno='+ GPS[i].REGNO +'>View</a></td></tr>'+ 
      '</table>', 
      title:GPS[i].SHOP + '(' +GPS[i].DIST + ')' 
      }); 
      markers.push(markers); 
      google.maps.event.addListener(markers[i], 'click', function() { 
      infowindow.setContent(this.Info); 
      infowindow.open(map,this); 
      }); 
     } 
     var markerClusterer = new MarkerClusterer(map, markers); 
     } 
    </script> 

這裏一個谷歌地圖ü可以檢查http://dnet.sml.com.pk/map/SFPLSurvey.aspx 當地圖加載它像冷凍意味着不要與Mouse.When移動我點擊潘移動然後它開始maving.Plz任何一個幫助我希望地圖應該移動時,它加載由用戶

回答

0

我不是專家,但var GPS = <%= GPS%>似乎傾倒了很多的信息進入頁面。很可能這是導致地圖凍結的原因。爲了調試的目的,刪除拉取的數據的數量並查看地圖是否按照您的意圖執行。

希望它有助於