clearoverlays in google maps v3 api

Posted on July 27th, 2010 by thiswayup.
Categories: dev.

Since api v2 has been now officially deprecated, I've been recently relearning some of the stuff to the new v3 api and trying to figure out the differences. One of the annoying things (as of writing) is the lack of clearOverlays().

There's a few ways to do it but the easiest way to do is maintain a separate array of markers then remove them one by one. So the code would look like :

while(markerArrayList[0]){
   markerArrayList.pop().setMap(null);
}

We keep going through the array in the while loop and pop an item until we don't have any more at which point the markerArrayList[0] will return false and stop the loop.


Example code here

I hope this helps some out there! Please feel free to comment!

0 comments.

Leave a comment

Comments can contain some xhtml. Names and emails are required (emails aren't displayed), url's are optional.




Easy payday loans, fast payday loans in UK. . Девушки москвы.смотреть онлайн порно бесплатно.Девушки по вызову. . HLI-PRE3SL uk supplier