From 69d567d13c555bec0e7d980e97d4aa6cc45ed5e3 Mon Sep 17 00:00:00 2001 From: Chandler Swift Date: Sun, 27 Aug 2023 16:33:51 -0500 Subject: [PATCH] Add light pollution layers --- layers/index.js | 2 ++ layers/light_pollution.js | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 layers/light_pollution.js diff --git a/layers/index.js b/layers/index.js index 674c962..59ca460 100644 --- a/layers/index.js +++ b/layers/index.js @@ -11,6 +11,7 @@ import census_bureau from './census-bureau/index.js'; import states from './states/index.js'; import national_land from './national-land/index.js'; import cellular from './cellular.js'; +import light_pollution from './light_pollution.js'; const layerCategories = [ { // Base maps @@ -79,6 +80,7 @@ const layerCategories = [ states, national_land, cellular, + light_pollution, ]; export default layerCategories; diff --git a/layers/light_pollution.js b/layers/light_pollution.js new file mode 100644 index 0000000..21a5a3d --- /dev/null +++ b/layers/light_pollution.js @@ -0,0 +1,28 @@ +import { XYZ } from 'ol/source.js'; +import TileLayer from 'ol/layer/Tile'; + +let layers = []; + +["2006", "2016", "2020"].forEach(year => { + layers.push({ + name: `djlorenz ${year}`, + layer: + new TileLayer({ + source: new XYZ({ + attributions: `David Lorenz's Light Pollution Atlas ${year}`, + maxZoom: 6, + tilePixelRatio:4, + tileSize: (1024, 1024), + transition: 0, + url: `https://djlorenz.github.io/astronomy/lp${year}/overlay/tiles/tile_{z}_{x}_{y}.png`, + }), + visible:true, + opacity: 0.5, + }), + }); +}); + +export default { + name: "Light Pollution", + layers: layers, +};