ok I understand, the place in the script is more important , I think I progress :
I have some marker clustered ! but In my script I compare marker for put her in categorie and with my modification the function categorie for hide or make appear catagorie doesn"t work . I think it's because my code isn't at the goog place. So can you check if I'm in the right way or not . Thx http://greglg.free.fr/spotme/final.html On Dec 1, 12:31 pm, Rossko <[email protected]> wrote: > > So I try to put this 3 lines in my function loadmap : > > > var markers = []; > > markers.push(marker); > > var markerCluster = new MarkerClusterer(map, markers); > > It's going to be very difficult if you don't think about what you are > telling the code to do. Where you put code in the order of events is > just as important as what the code does. > > So, in loadMap() ... > > > var markers = []; > > This will create an array called 'markers' > It is in local scope and won't be available after loadMap() has > completed. > You already have a global array called 'gmarkers' so I don't know what > this one is for at all. > > > markers.push(marker); > > You have this line before you have created any markers at all, so it > won't do anything useful. > That is what the script error was telling you. > Even if it did something, it wouldn't be very helpful as it would add > one marker to your array. You ought to be doing this inside the loop > where you are creating many markers, one at a time. So that as each > marker is created, it will be added to the array. > > > var markerCluster = new MarkerClusterer(map, markers); > > Again, this is before any markers have been created at all. As you > would like to pass in the markers that you want MarkerClusterer to > manage for you, it will work much better if you do this after all the > markers have been created and a copy of each one saved into whichever > array you choose to save them in and pass to the clusterer. -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
