I have a map on my webpage, which works fine, but I want to add data to it 
after it has been initialized.
The map that is showing, is a normal map, with about *20-30 custom* (static)
* markers* on it.

I would then like to add (*after 1 second*) a *marker* and a *polyline* to 
the map.

But then, the map should update with that data (the first 20-30 custom 
markers, the new marker and the polyline), *every 30 seconds*.

For refreshing the map, I could use a setInterval function to reinitialize 
the map every (for example) 5 seconds, but that doesnt work very well...

So, these are my two main questions:
*1. How do you add a marker to a map, after the map has been initialised?*
I tried: setting the map variable as a global variable, and then setting 
the marker for map: map, but that doesnt work:

var treinmarker = new google.maps.Marker({position: position, map: map, 
> title: 'Trein', icon: 'icon.png' });
>

*2. How do I update the position of a marker, without having to refresh the 
complete map? (thus having to add the marker again)*

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-js-api-v3/-/LhJ_g16s8f8J.
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.

Reply via email to