<p>Ad occhio non vedo nulla di sbagliato,<br>
il clearlayers lo chiami da un bottone? (se no, potrebbe essere un problema per la chiamata asincrona)<br>
prova a fare il console.log dei vari oggetti magari trovi la dicitura giusta..</p>
<p>ciao,<br>
stefano<br>
On Nov 6, 2013 4:38 PM, "Carlo Zardetto" <<a href="mailto:carlo@artmediastudio.com">carlo@artmediastudio.com</a>> wrote:<br>
><br>
> Salve ho un problema nella cancellazione dei markers.<br>
>  <br>
> Popolo la mappa tramite una chiamata json<br>
>  <br>
> myLayer = L.geoJson(url,{<br>
>             onEachFeature:function onEachFeature(feature, layer) {<br>
>                             //alert(feature.properties.icon.iconUrl);<br>
>                             ico=L.icon({iconUrl:feature.properties.icon.iconUrl, iconSize:[20,20],iconAnchor:[10,0]});<br>
>                 if (feature.geometry.type!="Point")<br>
>                 {<br>
>                     obj=$.geo.centroid(feature.geometry);<br>
>                     layer=L.marker(L.latLng(obj.coordinates[1],obj.coordinates[0]), {icon:ico});<br>
>                 }<br>
>                <br>
>                 if (feature.properties && <a href="http://feature.properties.name">feature.properties.name</a>) {<br>
>             //        layer.bindPopup(<a href="http://feature.properties.name">feature.properties.name</a>+"<br/><a href='<a href="http://www.openstreetmap.org/browse/">http://www.openstreetmap.org/browse/</a>"+feature.properties["@type"]+"/"+feature.properties["@id"]+"'>Guarda su OSM</a>");<br>

>                         layer.bindPopup(<a href="http://feature.properties.name">feature.properties.name</a>+"<br/>");<br>
>                 }<br>
>             },<br>
>             pointToLayer: function (feature, latlng) {       <br>
>                 var marker=L.marker(latlng, {icon:ico});<br>
>                 return marker;<br>
>             }<br>
>         }).addTo(map);<br>
>  <br>
> quindi pensavo che con un<br>
>  <br>
> myLayer.markerLayer.clearLayers(); oppure myLayer.clearLayers();<br>
> mi da errore<br>
> map.markerLayer.clearLayers();<br>
> non fa nulla.<br>
>  <br>
> le due variabili map e myLayer le ho dichiarate a livello globale infatti .<br>
>  <br>
> Qualcuno mi puņ dare una mano ?<br>
> Grazie<br>
>  <br>
>  <br>
><br>
> _______________________________________________<br>
> dev-italia mailing list<br>
> <a href="mailto:dev-italia@openstreetmap.org">dev-italia@openstreetmap.org</a><br>
> <a href="https://lists.openstreetmap.org/listinfo/dev-italia">https://lists.openstreetmap.org/listinfo/dev-italia</a><br>
><br>
</p>