/** * Nachtlicht-Layer: NASA VIIRS Black Marble Nighttime Lights (NRT). * Verwendet tagesaktuelle Daten statt statischem Datum. */ const NightlightsLayer = { _viewer: null, _layer: null, start: function(viewer) { if (this._layer) return; this._viewer = viewer; // NRT-Daten brauchen ~12-24h Processing, daher Datum von gestern var yesterday = new Date(Date.now() - 86400000).toISOString().slice(0, 10); this._layer = viewer.imageryLayers.addImageryProvider( new Cesium.WebMapTileServiceImageryProvider({ url: "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/VIIRS_Black_Marble/default/" + yesterday + "/500m/{TileMatrix}/{TileRow}/{TileCol}.png", layer: "VIIRS_Black_Marble", style: "default", tileMatrixSetID: "500m", tileMatrixLabels: [ "0", "1", "2", "3", "4", "5", "6", "7", "8", ], format: "image/png", tilingScheme: new Cesium.GeographicTilingScheme(), tileWidth: 512, tileHeight: 512, credit: "NASA VIIRS Black Marble (NRT)", }) ); this._layer.alpha = 0.85; }, stop: function() { if (this._layer && this._viewer) { this._viewer.imageryLayers.remove(this._layer); this._layer = null; } }, };