DRY Leaflet layers & the HTML template literal

Something like this should work:

Promise.all(["https://geospatial-analysis.s3.amazonaws.com/NEP/50059-002/barhabise-access-road_line.geojson", "another URL"].map(url => d3.json(url).then(data => L.geoJson(data).addTo(map)))

I’m not sure what you’re trying to do with the html template tag so I can’t help you with that.

1 Like