Hi,
I am having difficulty with displaying and removing marker. I am not
able to provide the link, because I am working in an environment
(rails) which I am not having hosting yet.
I am providing list of items on my page, every item has an ability to
show marker on the map. I want to display only one marker at one time
- if I click on next record, old marker would disappear and new would
come up. Sounds like an easy task, but for whatever reason I am not
successful at it.
I am using this function to show marker:
global var marker;
function showonmap(i)
{
//map.removeOverlay(marker);
//map.clearOverlay(marker);
marker = new GMarker(position[i]);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(desc[i]);
});
map.addOverlay(marker);
}
So function above displays markers. At the moment its just adding and
displaying markers, even the same one few times. I can use
map.clearOverlay(marker), which does what I want - showing only one
marker at the time - but when I zoom in/out, I could see all markers
again. If I use map.removeOverlay(marker) at the beginning, function
is not working at all - no marker gets displayed.
If you could spot what I am doing wrong, please advise. Would
appreciate a lot.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---