Hi, I'm using JavaScript Mapping Library - OpenLayer to create a markers overlay. I want to control the markers dynamically: add new ones and remove existing markers from the layer.
the way to add a new marker to the layer is by the command:
markers.addMarker(new OpenLayers.Marker(new OpenLayers.LonLat(0,0),icon));
as you can see, the initialization parameters contain only coordinates and icon image, not id, even not as an optional parameter.
in order to control the markers I want to create 2 dimensional array, that contain markers array by reference and ID array.
then, when I want to remove a marker from the layer, the command will be simply:
markers.removeMarker(ArrayMarkers[i]);
How do I push an element to JavaScript array by reference?
How can I run on ArrayMarkers elements by reference?