<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>Salve ho un problema nella cancellazione dei markers.</DIV>
<DIV> </DIV>
<DIV>Popolo la mappa tramite una chiamata json</DIV>
<DIV> </DIV>
<DIV><EM>myLayer = L.geoJson(url,{</EM></DIV>
<DIV><EM>
onEachFeature:function onEachFeature(feature, layer) {</EM></DIV>
<DIV><EM>
//alert(feature.properties.icon.iconUrl);</EM></DIV>
<DIV><EM>
ico=L.icon({iconUrl:feature.properties.icon.iconUrl,
iconSize:[20,20],iconAnchor:[10,0]});</EM></DIV>
<DIV><EM>
if (feature.geometry.type!="Point")</EM></DIV>
<DIV><EM>
{</EM></DIV>
<DIV><EM>
obj=$.geo.centroid(feature.geometry);</EM></DIV>
<DIV><EM>
layer=L.marker(L.latLng(obj.coordinates[1],obj.coordinates[0]),
{icon:ico});</EM></DIV>
<DIV><EM>
}</EM></DIV>
<DIV><EM>
</EM></DIV>
<DIV><EM>
if (feature.properties && feature.properties.name) {</EM></DIV>
<DIV><EM>
//
layer.bindPopup(feature.properties.name+"<br/><a href='</EM><A
href="http://www.openstreetmap.org/browse/"+feature.properties["@type"]+"/"+feature.properties["@id"]+"'"><EM>http://www.openstreetmap.org/browse/"+feature.properties["@type"]+"/"+feature.properties["@id"]+"'</EM></A><EM>>Guarda
su OSM</a>");</EM></DIV>
<DIV><EM>
layer.bindPopup(feature.properties.name+"<br/>");</EM></DIV>
<DIV><EM>
}</EM></DIV>
<DIV><EM>
},</EM></DIV>
<DIV><EM>
pointToLayer: function (feature, latlng)
{ </EM></DIV>
<DIV><EM>
var marker=L.marker(latlng, {icon:ico});</EM></DIV>
<DIV><EM>
return marker;</EM></DIV>
<DIV><EM>
}</EM></DIV>
<DIV><EM> }).addTo(map);</EM></DIV>
<DIV> </DIV>
<DIV>quindi pensavo che con un</DIV>
<DIV> </DIV>
<DIV>myLayer.markerLayer.clearLayers(); oppure myLayer.clearLayers();</DIV>
<DIV>mi da errore</DIV>
<DIV>map.markerLayer.clearLayers();</DIV>
<DIV>non fa nulla.</DIV>
<DIV> </DIV>
<DIV>le due variabili map e myLayer le ho dichiarate a livello globale infatti
.</DIV>
<DIV> </DIV>
<DIV>Qualcuno mi puņ dare una mano ?</DIV>
<DIV>Grazie</DIV>
<DIV> </DIV>
<DIV> </DIV></DIV></DIV></BODY></HTML>