0
在leaflet.js文檔中記錄了具有多層標記的示例。我想創建一個GeoJSON格式的多邊形圖層。這可能嗎?可能使用LayerGroup進行GeoJSON Polygons,MultiLineStrings和LineStrings?
我定義爲每個GeoJSON的多邊形一個變量,叫ROUTE1,路徑2等我的.js文件看起來是這樣的:
var map = L.map('map', {
center: [55.676098, 12.568337],
});
L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="http://osm.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
//============
//Create layer
//============
var Southroutes = new L.layerGroup([route1, route2, route3, route4, route5]);
L.geoJSON(Southroutes).addTo(map);