簡體   English   中英

Google地圖停止顯示點v3

[英]Google maps stop showing points v3

嗨,我很難找到哪種情況下會在護目鏡地圖上顯示航路點時出現問題,因為威爾的代碼沒有變化。 途中點停止顯示大約上周。 我不熟悉Google API

 var map = null; var markerArray = []; //create a global array to store markers var myPoints = [ [52.664167, -8.509825,' HQ','favicon.ico'] ,[52.836346, -6.913117,'point 1','http://maps.google.com/mapfiles/ms/icons/red.png ' ],[52.836202, -6.912101,'point2','http://maps.google.com/mapfiles/ms/icons/red.png ' ]]; function initialize() { var myOptions = { zoom:7, center: new google.maps.LatLng(53.112, -7.448), mapTypeControl: true, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU }, navigationControl: true, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map"), myOptions); var mcOptions = { gridSize: 30, maxZoom: 15 }; var mc = new MarkerClusterer(map, [], mcOptions); google.maps.event.addListener(map, 'click', function() { infowindow.close(); }); // Add markers to the map // Set up markers based on the number of elements within the myPoints array for(var i=0; i<myPoints.length; i++){ createMarker(new google.maps.LatLng(myPoints[i][0], myPoints[i][1]), myPoints[i][2], myPoints[i][3]); } mc.addMarkers(markerArray , true); } var infowindow = new google.maps.InfoWindow({ size: new google.maps.Size(150, 50) }); function createMarker(latlng, html, icons) { var contentString = html; var links = icons; var marker = new google.maps.Marker({ position: latlng, map: map, icon: links , zIndex: Math.round(latlng.lat() * -100000) << 5 }); // marker.setAnimation(google.maps.Animation.BOUNCE); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(contentString); infowindow.open(map, marker); }); markerArray.push(marker); //push local var marker into global array } window.onload = initialize; 
 <script src="https://maps.googleapis.com/maps/api/js?v=3" type="text/javascript"></script> <div id="map" style="width: 800px; height: 750px;" ></div> 

有什么建議么?

看來您使用的是MarkerClusterer ,它是最近移動的google maps實用程序庫的一部分。 可能有人在您的項目中直接從code.google.com/svn / ...引用了該庫,現在該庫不再可用,這就是為什么它已損壞的原因。 您需要找到https://google-maps-utility-library-v3.googlecode.com/svn引用的所有庫,然后替換為您自己的鏈接。

檢查此SO問題 ,用戶與您有非常相似的問題。

也! 在SO !! 檢查此問題和答案 ,有些用戶在同一庫中遇到問題,以獲得更多信息。 閱讀所有答案,因為將https://google-maps-utility-library-v3.googlecode.com/svn替換為https://rawgit.com/googlemaps/是不正確的解決方案,所以您應該下載該庫資產到您的項目中,然后從那里引用它們或使用CDN(但不使用git!)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM