Add light pollution layers

This commit is contained in:
Chandler Swift 2023-08-27 16:33:51 -05:00
parent 8c011b481a
commit 69d567d13c
Signed by: chandlerswift
GPG key ID: A851D929D52FB93F
2 changed files with 30 additions and 0 deletions

View file

@ -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;

28
layers/light_pollution.js Normal file
View file

@ -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: `<a href='https://djlorenz.github.io/astronomy/lp${year}/'>djlorenz ${year}</a>`,
layer:
new TileLayer({
source: new XYZ({
attributions: `David Lorenz's <a href=http://djlorenz.github.io/astronomy/lp${year}/>Light Pollution Atlas ${year}</a>`,
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,
};