Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Improve line ref visibility

Russ Garrett00a4b2029958
diff --git a/src/style/style_oim_power.js b/src/style/style_oim_power.js
index 62f98d4..a94d375 100644
--- a/src/style/style_oim_power.js
+++ b/src/style/style_oim_power.js
@@ -186,7 +186,7 @@ const substation_label_visible_p = ["all",
];
-// Power line visibility
+// Power line / substation visibility
const power_visible_p = ["all",
["any",
[">", ['coalesce', ['get', 'voltage'], 0], 199],
@@ -218,6 +218,33 @@ const power_visible_p = ["all",
];
+// Power line ref visibility
+const power_ref_visible_p = ["all",
+ ["any",
+ ['all',
+ [">", ['coalesce', ['get', 'voltage'], 0], 330],
+ [">", ['zoom'], 7]
+ ],
+ ['all',
+ [">", ['coalesce', ['get', 'voltage'], 0], 200],
+ [">", ['zoom'], 8]
+ ],
+ ['all',
+ [">", ['coalesce', ['get', 'voltage'], 0], 100],
+ [">", ['zoom'], 9]
+ ],
+ [">", ['zoom'], 10]
+ ],
+ ["any",
+ ['all',
+ ["!=", ['get', 'line'], 'busbar'],
+ ["!=", ['get', 'line'], 'bay'],
+ ],
+ [">", ['zoom'], 12]
+ ]
+];
+
+
const plant_label_visible_p = ["any",
[">", ['coalesce', ['get', 'output'], 0], 1000],
['all',
@@ -239,6 +266,7 @@ const plant_label_visible_p = ["any",
[">", ['zoom'], 10]
];
+
function plant_image() {
let expr = ["match", ['get', 'source']]
for (const [key, value] of Object.entries(plant_types)) {
@@ -627,13 +655,13 @@ const layers = [
id: 'power_line_ref',
type: 'symbol',
filter: ['all',
- power_visible_p,
+ power_ref_visible_p,
['!=', ['coalesce', ['get', 'ref'], ''], ''],
['<', ['length', ['get', 'ref']], 5]
],
source: 'openinframap',
'source-layer': 'power_line',
- minzoom: 10,
+ minzoom: 7,
layout: {
'icon-image': 'power_line_ref',
'text-field': '{ref}',