leaflet-environmental-layers
Version:
[](https://gitpod.io/#https://github.com/publiclab/leaflet-environmental-layers/) [](http
18 lines (16 loc) • 424 B
JavaScript
const layers = require("./layers.json");
for (const layer of layers) {
//Evaluate based on dynamic data
let newLayer = function (options) {
return new L.SpreadsheetLayer({
url: layer.url,
lat: "Latitude",
lon: "Longitude",
generatePopup: function () {},
imageOptions: {
icon: L.icon.mapKnitterIcon(),
},
});
};
eval("L.layerGroup." + layer.name + "=newLayer");
}