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() ' –