문제

Couple days ago markermanager stopped working properly with google maps. I have no error in console view.

It's breaking on line:

var div = this.getProjection().fromLatLngToDivPixel(latlng)

this is whole method:

ProjectionHelperOverlay.prototype.LatLngToPixel = function (latlng, zoom) {
alert('p1');//displays alert
var map = this._map;//object
alert('p2');//displays alert
alert(latlng);//displays object
var div = this.getProjection().fromLatLngToDivPixel(latlng);
alert('p3');//NO ALERT and NO error in console
var abs = {x: ~~(0.5 + this.LngToX_(latlng.lng()) * (2 << (zoom + 6))), y: ~~(0.5 + this.LatToY_(latlng.lat()) * (2 << (zoom + 6)))};
alert('p4');//never gets to that line
return abs;
};

Everything was fine before and I didn't make any changes. Could it be error with new google maps API code? I can't find newer version of markermanager. Is there any replacement for this script?

도움이 되었습니까?

해결책

Are you either using the nightly/experimental version (v3.exp), v3 or an old version?

Versioning

If so the version of the maps API could have changed underneath your page. The Google Maps API team recommends you hardcode the version number on production pages and test newer versions before going live with them.

다른 팁

I was having the same error, adding a listener to the loaded event did it for me:

 var mgr = new MarkerManager(map)
 google.maps.event.addListener(mgr, 'loaded', function(){
    mgr.addMarkers(markers, 5,6)
  });   
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top