- imagery.js: WMTS-Support fuer NASA GIBS + 4 neue Quellen (MODIS Terra, VIIRS SNPP, GOES East/West) - firms.js: Neuer VIIRS Thermal Anomalies Layer (375m, tagesaktuell, Braende/Industriewaerme) - nightlights.js: NRT-Upgrade (dynamisches Datum statt hardcodiert 2024-01-01) - index.html: Optgroups im Imagery-Select, FIRMS-Checkbox, Script-Tag - app.js: FIRMS Toggle - globe.css: dot-firms Farbe Alle NASA-Daten kostenlos via GIBS WMTS, kein API-Key noetig. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
170 Zeilen
6.1 KiB
JavaScript
170 Zeilen
6.1 KiB
JavaScript
/**
|
|
* Imagery Switcher: Verschiedene Satellitenbilder + historische Aufnahmen.
|
|
* Unterstuetzt URL-Template (Esri, Sentinel, OSM) und WMTS (NASA GIBS).
|
|
*/
|
|
const ImagerySwitch = {
|
|
_viewer: null,
|
|
_currentLayer: null,
|
|
_currentId: "default",
|
|
|
|
_sources: {
|
|
"default": { name: "Cesium Ion (Standard)", url: null },
|
|
"esri": {
|
|
name: "Esri World Imagery",
|
|
url: "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",
|
|
},
|
|
"nasa-modis": {
|
|
name: "NASA MODIS Terra (Heute)",
|
|
wmts: {
|
|
url: "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi",
|
|
layer: "MODIS_Terra_CorrectedReflectance_TrueColor",
|
|
tileMatrixSetID: "250m",
|
|
format: "image/jpeg",
|
|
time: "today",
|
|
maxLevel: 8,
|
|
},
|
|
},
|
|
"nasa-viirs": {
|
|
name: "NASA VIIRS SNPP (Heute)",
|
|
wmts: {
|
|
url: "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi",
|
|
layer: "VIIRS_SNPP_CorrectedReflectance_TrueColor",
|
|
tileMatrixSetID: "250m",
|
|
format: "image/jpeg",
|
|
time: "today",
|
|
maxLevel: 8,
|
|
},
|
|
},
|
|
"nasa-goes-east": {
|
|
name: "NASA GOES East (Live)",
|
|
wmts: {
|
|
url: "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi",
|
|
layer: "GOES-East_ABI_GeoColor",
|
|
tileMatrixSetID: "2km",
|
|
format: "image/jpeg",
|
|
time: null,
|
|
maxLevel: 5,
|
|
},
|
|
},
|
|
"nasa-goes-west": {
|
|
name: "NASA GOES West (Live)",
|
|
wmts: {
|
|
url: "https://gibs.earthdata.nasa.gov/wmts/epsg4326/best/wmts.cgi",
|
|
layer: "GOES-West_ABI_GeoColor",
|
|
tileMatrixSetID: "2km",
|
|
format: "image/jpeg",
|
|
time: null,
|
|
maxLevel: 5,
|
|
},
|
|
},
|
|
"s2-2024": {
|
|
name: "Sentinel-2 (2024)",
|
|
url: "https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2024_3857/default/GoogleMapsCompatible/{z}/{x}/{y}.jpg",
|
|
},
|
|
"s2-2023": {
|
|
name: "Sentinel-2 (2023)",
|
|
url: "https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2023_3857/default/GoogleMapsCompatible/{z}/{x}/{y}.jpg",
|
|
},
|
|
"s2-2022": {
|
|
name: "Sentinel-2 (2022)",
|
|
url: "https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2022_3857/default/GoogleMapsCompatible/{z}/{x}/{y}.jpg",
|
|
},
|
|
"s2-2020": {
|
|
name: "Sentinel-2 (2020)",
|
|
url: "https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2020_3857/default/GoogleMapsCompatible/{z}/{x}/{y}.jpg",
|
|
},
|
|
"s2-2018": {
|
|
name: "Sentinel-2 (2018)",
|
|
url: "https://tiles.maps.eox.at/wmts/1.0.0/s2cloudless-2018_3857/default/GoogleMapsCompatible/{z}/{x}/{y}.jpg",
|
|
},
|
|
"topo": {
|
|
name: "OpenTopoMap",
|
|
url: "https://tile.opentopomap.org/{z}/{x}/{y}.png",
|
|
},
|
|
"osm": {
|
|
name: "OpenStreetMap",
|
|
url: "https://a.tile.openstreetmap.org/{z}/{x}/{y}.png",
|
|
},
|
|
},
|
|
|
|
init(viewer) {
|
|
this._viewer = viewer;
|
|
},
|
|
|
|
_getGibsLabels(maxLevel) {
|
|
var labels = [];
|
|
for (var i = 0; i <= maxLevel; i++) labels.push(String(i));
|
|
return labels;
|
|
},
|
|
|
|
switchTo(id) {
|
|
if (!this._viewer || this._currentId === id) return;
|
|
var src = this._sources[id];
|
|
if (!src) return;
|
|
|
|
// Alten Layer entfernen
|
|
if (this._currentLayer) {
|
|
this._viewer.imageryLayers.remove(this._currentLayer);
|
|
this._currentLayer = null;
|
|
}
|
|
|
|
if (id === "default") {
|
|
this._currentId = id;
|
|
} else if (src.wmts) {
|
|
// NASA GIBS WMTS Provider
|
|
var w = src.wmts;
|
|
var opts = {
|
|
url: w.url,
|
|
layer: w.layer,
|
|
tileMatrixSetID: w.tileMatrixSetID,
|
|
format: w.format,
|
|
style: "default",
|
|
tileWidth: 512,
|
|
tileHeight: 512,
|
|
tilingScheme: new Cesium.GeographicTilingScheme(),
|
|
tileMatrixLabels: this._getGibsLabels(w.maxLevel),
|
|
credit: "NASA GIBS",
|
|
};
|
|
if (w.time === "today") {
|
|
opts.times = new Cesium.TimeIntervalCollection([
|
|
new Cesium.TimeInterval({
|
|
start: Cesium.JulianDate.fromIso8601(new Date().toISOString().slice(0, 10)),
|
|
stop: Cesium.JulianDate.fromIso8601("9999-12-31"),
|
|
}),
|
|
]);
|
|
opts.clock = this._viewer.clock;
|
|
} else if (w.time) {
|
|
opts.times = new Cesium.TimeIntervalCollection([
|
|
new Cesium.TimeInterval({
|
|
start: Cesium.JulianDate.fromIso8601(w.time),
|
|
stop: Cesium.JulianDate.fromIso8601("9999-12-31"),
|
|
}),
|
|
]);
|
|
opts.clock = this._viewer.clock;
|
|
}
|
|
this._currentLayer = this._viewer.imageryLayers.addImageryProvider(
|
|
new Cesium.WebMapTileServiceImageryProvider(opts)
|
|
);
|
|
this._viewer.imageryLayers.lower(this._currentLayer);
|
|
this._currentId = id;
|
|
} else {
|
|
// URL Template Provider (Esri, Sentinel, OSM)
|
|
this._currentLayer = this._viewer.imageryLayers.addImageryProvider(
|
|
new Cesium.UrlTemplateImageryProvider({
|
|
url: src.url,
|
|
maximumLevel: 18,
|
|
credit: src.name,
|
|
})
|
|
);
|
|
this._viewer.imageryLayers.lower(this._currentLayer);
|
|
this._currentId = id;
|
|
}
|
|
|
|
// Dropdown aktualisieren
|
|
var sel = document.getElementById("imagery-select");
|
|
if (sel) sel.value = id;
|
|
var label = document.getElementById("imagery-label");
|
|
if (label) label.textContent = src.name;
|
|
},
|
|
};
|