1
我是使用geojson创建折线。我以GeoJSON的格式如下:Leaflet clear geojson layer(polyline)
var myLines = [{
"type": "LineString",
"coordinates": [[-75, 21.9], [-75.4, 22.7], [-76.5, 23.4]]
}, {
"type": "LineString",
"coordinates": [[-105, 40], [-110, 45], [-115, 55]]
}];
L.geoJson(myLines).addTo(map);
我有如下明显的折线功能:
function clear_polyline(){
$.each(myLines, function(ind,poly){
map.removeLayer(poly);
});
}
此功能不会清除层也不会引发任何错误。 如何清除传单中的折线?
我认为它应该更喜欢阅读:'linesFeatureLayer.clearLayers() ' –