[OpenLayers-Dev] delete a marker when i redraw an other marker
steve1000
ligerstephane at free.fr
Sun Feb 24 10:08:47 EST 2008
Thanks for the reponse,
Then i stay wait for the solution, i found it. I take the exemple (yes, all
is in the example) popups.html and I modified a few.
For example in the init, i add:
map.events.register("click", map, function(e) {
var lonlat = map.getLonLatFromViewPortPx(e.xy);
document.getElementById('Nord').value = lonlat.lat;
document.getElementById('Est').value = lonlat.lon;
addMarker(lonlat.lon,lonlat.lat);
});
I modified too:
function addMarker(x,y) {
markers = new OpenLayers.Layer.Markers("zibo");
map.addLayer(markers);
feature = new OpenLayers.Feature(layer,new OpenLayers.LonLat(x,y));
marker = feature.createMarker();
markers.addMarker(marker);
marker.events.register("mousedown", marker, mousedown);
}
and :
function removelayer() {
//layer.destroy();
map.removeLayer(markers);
}
I add too in the body:
<input type='button' value='Efface' onClick="removelayer()">
There are still some bug, but i's good.
Thanks you for your reponse
A+ Stéphane
--
View this message in context: http://www.nabble.com/delete-a-marker-when-i-redraw-an-other-marker-tp15613723p15665085.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.
More information about the Dev
mailing list