[OpenLayers-Dev] delete a marker when i redraw an other marker

steve1000 ligerstephane at free.fr
Thu Feb 21 11:20:38 EST 2008


All is in the title, i would want to erase the marker when i redraw an other
marker. 

My Code:
map.events.register("click", map, function(e,marker) {    
         	
        	//markers.removeMarker();my code who is the problem
            	//markers.clearMarkers();my code who is the problem
 
		var lonlat = map.getLonLatFromViewPortPx(e.xy);    

		document.getElementById('Nord').value = lonlat.lat; 
		document.getElementById('Est').value = lonlat.lon; 
            	
		var markers = new OpenLayers.Layer.Markers( "Markers" );
		
		map.addLayer(markers);
		
		var size = new OpenLayers.Size(10,17);
		var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
		var icon = new OpenLayers.Icon('../img/marker.png',size,offset);
		

		markers.addMarker(new OpenLayers.Marker(new
OpenLayers.LonLat(lonlat.lon,lonlat.lat),icon));
		markers.addMarker(new OpenLayers.Marker(new
OpenLayers.LonLat,icon.clone(lonlat.lon,lonlat.lat)));
		
		});  


I am no example for the use of this function : markers.removeMarker(); and
markers.clearMarkers(); so if you think that you would to help me please
write me.
Thank you for the reponse, have a nice day ,
A+ Stéphane 
                                
-- 
View this message in context: http://www.nabble.com/delete-a-marker-when-i-redraw-an-other-marker-tp15613723p15613723.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.




More information about the Dev mailing list