Google Maps V3: Only show markers in viewport - Clear markers issue?

You need to add another Event Listener to the map: google.maps.event. AddListener(map,'bounds_changed', removeMarkers) See here for more on removing all markers from a google map - unfortunately I don't think it can be done with one call. So you will have to write the removeMarkers or something similar which will have to iterate through all the markers on the map removing them individually like so: markersArrayi.

SetMap(null) I don't know whether it's quicker to check if the marker is in the viewport before removing by using: map.getBounds().

You need to add another Event Listener to the map: google.maps.event. AddListener(map,'bounds_changed', removeMarkers); See here for more on removing all markers from a google map - unfortunately I don't think it can be done with one call. So you will have to write the removeMarkers or something similar which will have to iterate through all the markers on the map removing them individually like so: markersArrayi.

SetMap(null); I don't know whether it's quicker to check if the marker is in the viewport before removing by using: map.getBounds().

Thanks for your reply! Why do I have to use 'bounds_changed'? The Event Listener I'm using now ('Tilesloaded') seems to do the same, every time the viewport changes the functions loadMapFromCurrentBounds() is called.

I've tried markersArrayi. SetMap(null); but it doesn't work. Besides that, I like the solutions where I only clear the markers that aren't in the viewport anymore... I'll try to upload an example later this evening!

– Thijs Jun 1 '10 at 14:13.

You may want to check out this thread. Daniel answered this quite nicely. stackoverflow.com/questions/2914615/what... Also, bounds_changed is the first opportunity to call your function.

Tilesloaded, will be called constantly. The viewport may contain more than one tile to fill the viewport. Alternatively, you can also do a setVisible(false).

In order to remove the marker, you may need to remove the listeners. Google.maps.event. ClearInstanceListeners(marker); marker.

SetMap(null); markers. Remove(marker); delete marker.

Var myLatlng = new google.maps. Var map = new google.maps. Var markers = xml.documentElement.

Var infoWindow = new google.maps. For (var I = 0; I Var type = markersi. Var name = markersi.

Var point = new google.maps. Var marker = new google.maps.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions