[Talk-it] cancellazione dei markers
akstern
carlo a artmediastudio.com
Mer 6 Nov 2013 16:09:46 UTC
Salve scrivo qui perchè il mio messaggio su dev-italia non è stato
recapitato.
Ho un problema nella cancellazione dei markers.
Popolo la mappa tramite una chiamata json
myLayer = L.geoJson(url,{
onEachFeature:function onEachFeature(feature, layer) {
//alert(feature.properties.icon.iconUrl);
ico=L.icon({iconUrl:feature.properties.icon.iconUrl,
iconSize:[20,20],iconAnchor:[10,0]});
if (feature.geometry.type!="Point")
{
obj=$.geo.centroid(feature.geometry);
layer=L.marker(L.latLng(obj.coordinates[1],obj.coordinates[0]), {icon:ico});
}
if (feature.properties && feature.properties.name) {
// layer.bindPopup(feature.properties.name+"<br/> Guarda
su OSM
<http://www.openstreetmap.org/browse/"+feature.properties["@type"]+"/"+feature.properties["@id"]+">
");
layer.bindPopup(feature.properties.name+"<br/>");
}
},
pointToLayer: function (feature, latlng) {
var marker=L.marker(latlng, {icon:ico});
return marker;
}
}).addTo(map);
quindi pensavo che con un
myLayer.markerLayer.clearLayers(); oppure myLayer.clearLayers();
mi da errore
map.markerLayer.clearLayers();
non fa nulla.
le due variabili map e myLayer le ho dichiarate a livello globale infatti
il firebug mi segnala gli oggetti con relativi metodi.
Qualcuno mi può dare una mano ?
Grazie
--
View this message in context: http://gis.19327.n5.nabble.com/cancellazione-dei-markers-tp5784355.html
Sent from the Italy General mailing list archive at Nabble.com.
Maggiori informazioni sulla lista
Talk-it