简体   繁体   中英

Google maps stop showing points v3

Hi i have trouble to find what case a problem to showing the way point on goggle maps as there were no changes in the code for a wile. way point stop showing about last week. im not familiar with 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> 

Any suggestions?

It seems that you are using MarkerClusterer which is a part of google maps utility library, which was moved recently. Somebody probably referenced the library straight from code.google.com/svn/... in your project, where it's not available anymore and that's why it's broken. You need to find all libraries which are referenced from https://google-maps-utility-library-v3.googlecode.com/svn and replace then with your own links.

Check this SO question , user had very similar issues to yours.

Also! check this question and answers on SO !!, there are users who experienced issues with the same library, to get more information. Read all answers, as replacing https://google-maps-utility-library-v3.googlecode.com/svn with https://rawgit.com/googlemaps/ ... is not a correct solution, you should download the library assets into your project and reference them from there or use CDN (but not git!).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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