superscral
superscral

Reputation: 480

ClusterMarkerer - no cluster appear - this.map_.mapTypes[this.map_.getMapTypeId()] is undefined markerclusterer.js:304

I have an issue with my MarkerClusterer.

When i was 400 markers, cluster appears, all worked. But now i have moire than 600 markers and cluster don't appear.

Firebug display this error:

that.map_.mapTypes[that.map_.getMapTypeId()] is undefined  markerclusterer.js:304

Have you an idea?

Thanks

Upvotes: 2

Views: 2591

Answers (8)

Dolpox
Dolpox

Reputation: 98

Update your markercluster.js to the latest revision: http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/src/markerclusterer.js

and your problem will be solved!

Upvotes: 3

Jay
Jay

Reputation: 3355

I fixed it sorta the same way but slightly different.. Best way it to update your code.. this code augments the property back where it is expected.

    var that = this;
    google.maps.event.addListener(this.map_, 'zoom_changed', function() {
        try{
           var maxZoom = that.map_.mapTypes[that.map_.getMapTypeId()].maxZoom;
        } catch(Error){ maxZoom = that.map_.mapTypes[that.map_.getMapTypeId()].maxZoom = 20; }
        var zoom = that.map_.getZoom();
        if (zoom < 0 || zoom > maxZoom) return;     

        if (that.prevZoom_ != zoom) {
           that.prevZoom_ = that.map_.getZoom();
           that.resetViewport();
        }
});

Upvotes: 0

kuty
kuty

Reputation: 1

Same error message after "click" on cluster.

Solution:

Upvotes: 0

LutsenkoDV
LutsenkoDV

Reputation: 1

In markerclusterer.js at line 156 change code from

var maxZoom = that.map_.mapTypes[that.map_.getMapTypeId()].maxZoom;

to var maxZoom = 18;

Upvotes: 0

Pierluigi
Pierluigi

Reputation: 44

the best solution is switching to api 3.5 waiting a fix by google.
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.5&sensor=true"></script>

Upvotes: 2

mtom
mtom

Reputation: 151

It seems that google have changed something in the api. You can manually set the maxZoom value in your cluster options or in your map options to something like 16, then it works again. If you have other layers like Bing oder OSM, you have to set their maxZoom values too.

var clusterOptions = { styles: ClusterStyles, maxZoom: 16 };
markerClusterer = new MarkerClusterer(map, markersArray, clusterOptions);

Upvotes: 1

sas
sas

Reputation: 1

Yep, woke up to mine broken too.

Comments here worked, I added maxZoom: 18 to my initialization.

     footer_map = new google.maps.Map(document.getElementById('footer_map'), {
      zoom: 1,
      center: new google.maps.LatLng(42, 0),
      mapTypeId: google.maps.MapTypeId.ROADMAP,
      zoomOnClick: true,
      maxZoom: 18
    });

Upvotes: 0

Pierluigi
Pierluigi

Reputation: 44

i think that maps api are changed and mapsTypes array don't has the maxZoom property

Upvotes: 0

Related Questions