Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Add nighttime lights layer

Russ Garrettf5ce41c411d4
diff --git a/web/locales/en/translation.json b/web/locales/en/translation.json
index 9a7be5b..a1a76c9 100644
--- a/web/locales/en/translation.json
+++ b/web/locales/en/translation.json
@@ -186,6 +186,7 @@
"webgl": "<p>Your browser may have performance or functionality issues with Open Infrastructure Map.</p><p><a href=\"http://webglreport.com\">WebGL</a> with hardware acceleration is required for this site to perform well.</p><p>If your browser supports WebGL, you may need to disable browser fingerprinting protection for this site.</p>"
},
"layers": {
+ "nighttime-lights": "Nighttime Lights",
"power": "Power",
"heatmap": "Solar Generation",
"telecoms": "Telecoms",
diff --git a/web/src/openinframap.ts b/web/src/openinframap.ts
index 7f382dc..25c8e23 100644
--- a/web/src/openinframap.ts
+++ b/web/src/openinframap.ts
@@ -85,6 +85,7 @@ export default class OpenInfraMap {
const layer_switcher = new LayerSwitcher(
[
+ new Layer('N', t('layers.nighttime-lights', 'Nighttime Lights'), 'black_marble', false),
new Layer('P', t('layers.power', 'Power'), 'power_', true),
new Layer('S', t('layers.heatmap', 'Solar Generation'), 'heatmap_', false),
new Layer('T', t('layers.telecoms', 'Telecoms'), 'telecoms_', false),
diff --git a/web/src/style/style.ts b/web/src/style/style.ts
index 63b78cf..69844dd 100644
--- a/web/src/style/style.ts
+++ b/web/src/style/style.ts
@@ -10,9 +10,9 @@ const style: StyleSpecification = {
type: 'globe'
},
sky: {
- 'sky-color': '#3BEAED',
+ 'sky-color': '#1A6566',
'horizon-color': '#863BED',
- 'fog-color': '#C3E3F5',
+ 'fog-color': '#4B575E',
'sky-horizon-blend': 0.5,
'horizon-fog-blend': 0.5,
'fog-ground-blend': 0.5,
@@ -31,6 +31,13 @@ const style: StyleSpecification = {
maxzoom: 14,
attribution: '<a href="https://openmaptiles.org/">OpenMapTiles</a>'
},
+ blackmarble: {
+ type: 'raster',
+ tiles: ['https://openinframap.org/black-marble-2023/{z}/{x}/{y}.webp'],
+ maxzoom: 8,
+ attribution:
+ '<a href="https://ladsweb.modaps.eosdis.nasa.gov/missions-and-measurements/products/VNP46A4/">NASA Black Marble 2023</a>'
+ },
power: {
type: 'vector',
tiles: ['https://openinframap.org/map/power/{z}/{x}/{y}.pbf'],
diff --git a/web/src/style/style_base.ts b/web/src/style/style_base.ts
index e45f070..f0b1427 100644
--- a/web/src/style/style_base.ts
+++ b/web/src/style/style_base.ts
@@ -525,6 +525,18 @@ const layers: LayerSpecificationWithZIndex[] = [
'line-blur': ['interpolate', ['linear'], ['zoom'], 0, 0.4, 22, 4],
'line-dasharray': [3, 3]
}
+ },
+ {
+ id: 'black_marble_background',
+ type: 'background',
+ paint: {
+ 'background-color': 'rgb(3,1,19)'
+ }
+ },
+ {
+ id: 'black_marble',
+ type: 'raster',
+ source: 'blackmarble'
}
]