Hi there :D
I got a map with a looooot of markers. Because of the users
performance I use var bounds = map.getBounds(); for
checking whether a marker is at the line of view for the user or not.
This is working pretty good and I created a function called create() :
function create() {
geocoder = new GClientGeocoder();
GDownloadUrl("bugfix.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName
("marker");
var bounds = map.getBounds();
for (var i = 0; i < markers.length; i++) {
var name = markers[i].getAttribute("name");
var address = markers[i].getAttribute("address");
var type = markers[i].getAttribute("type");
var point = new GLatLng(parseFloat(markers[i].getAttribute
("lat")),
parseFloat(markers[i].getAttribute("lng")));
if
(bounds.contains(point) == true)
{
var marker = createMarker(point, name, address, type);
map.addOverlay(marker);
}
}
It's working pretty good. Whether the user zooms away or drags the
map , the markers at this position will not be set because they were
not seeable when the map was loaded, so I wrote window.setInterval
("create()", 3000);
This is working fine, too
The problem is: When a User doesn't move the map, GMaps will not
override the existing markers but place another one over them. Imagine
you're at a place with 50 markers, after 3 Seconds there will be 100,
after three more seconds 150 and so on.
How to check whether a marker is allready placed and if it is, skip
placing a new one?
Or is there a better way as using setInterval ?
Greetings,
Huggy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---