Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Improve substation icon visibility for small substations

Russ Garrett2c21ab8e9ac3
diff --git a/src/style/style_oim_power.js b/src/style/style_oim_power.js
index c242966..62f98d4 100644
--- a/src/style/style_oim_power.js
+++ b/src/style/style_oim_power.js
@@ -124,7 +124,7 @@ const substation_visible_p = ["all",
[">", ['zoom'], 7]
],
['all',
- [">", ['coalesce', ['get', 'voltage'], 0], 19],
+ [">", ['coalesce', ['get', 'voltage'], 0], 25],
[">", ['zoom'], 9]
],
['all',
@@ -150,6 +150,21 @@ const substation_radius = [
]
]
+// Determine the minimum zoom a point is visible at (before it can be seen as an
+// area), based on the area of the substation.
+const substation_point_visible_p = ["any",
+ ["==", ["coalesce", ["get", "area"], 0], 0], // Area = 0 - mapped as node
+ ["all",
+ ["<", ["coalesce", ["get", "area"], 0], 100],
+ ["<", ["zoom"], 16]
+ ],
+ ["all",
+ ["<", ["coalesce", ["get", "area"], 0], 250],
+ ["<", ["zoom"], 15]
+ ],
+ ["<", ["zoom"], 13]
+]
+
const substation_label_visible_p = ["all",
["any",
[">", ['coalesce', ['get', 'voltage'], 0], 399],
@@ -592,11 +607,10 @@ const layers = [
zorder: 268,
id: 'power_substation_point',
type: 'circle',
- filter: substation_visible_p,
+ filter: ["all", substation_visible_p, substation_point_visible_p],
source: 'openinframap',
'source-layer': 'power_substation_point',
minzoom: 5,
- maxzoom: 13,
layout: {},
paint: {
'circle-radius': substation_radius,
@@ -608,21 +622,6 @@ const layers = [
]
},
},
- {
- zorder: 269,
- id: 'power_substation_point_map',
- type: 'circle',
- filter: ['get', 'is_node'],
- source: 'openinframap',
- 'source-layer': 'power_substation_point',
- minzoom: 13,
- layout: {},
- paint: {
- 'circle-radius': 4,
- 'circle-color': voltage_color('voltage'),
- 'circle-stroke-width': 1
- },
- },
{
zorder: 560,
id: 'power_line_ref',