Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Power style tweaks

Russ Garrettba475a0ba4ad
diff --git a/web/src/style/style_oim_power.ts b/web/src/style/style_oim_power.ts
index 2d028c9..6836f39 100644
--- a/web/src/style/style_oim_power.ts
+++ b/web/src/style/style_oim_power.ts
@@ -91,7 +91,7 @@ const multi_voltage_min_zoom = 10
// Generate an expression to determine the offset of a power line
// segment with multiple voltages
function voltage_offset(index: number): DataDrivenPropertyValueSpecification<number> {
- const spacing = 7
+ const spacing = 14
const offset = (index - 1) * spacing
return interpolate(zoom, [
@@ -100,14 +100,14 @@ function voltage_offset(index: number): DataDrivenPropertyValueSpecification<num
multi_voltage_min_zoom,
case_(
[
- [has('voltage_3'), (offset - spacing) * 0.5],
- [has('voltage_2'), (offset - spacing / 2) * 0.5]
+ [has('voltage_3'), (offset - spacing) * 0.3],
+ [has('voltage_2'), (offset - spacing / 2) * 0.3]
],
0
)
],
[
- 13,
+ 21,
case_(
[
[has('voltage_3'), offset - spacing],
@@ -121,24 +121,30 @@ function voltage_offset(index: number): DataDrivenPropertyValueSpecification<num
// Function to assign power line thickness.
// Interpolate first by zoom level and then by voltage.
-const voltage_line_thickness: ExpressionSpecification = interpolate(zoom, [
- [2, 0.5],
+const voltage_line_thickness: ExpressionSpecification = interpolate(
+ zoom,
[
- 10,
- match(
- get('line'),
- [
- ['bay', 1],
- ['busbar', 1]
- ],
- interpolate(coalesce(get('voltage'), 0), [
- [0, 1],
- [100, 1.8],
- [800, 4]
- ])
- )
- ]
-])
+ [1, 0.5],
+ [
+ 21,
+ match(
+ get('line'),
+ [
+ ['bay', 1],
+ ['busbar', 1]
+ ],
+ interpolate(coalesce(get('voltage'), 0), [
+ [0, 1.5],
+ [20, 2],
+ [30, 4],
+ [100, 6],
+ [500, 9]
+ ])
+ )
+ ]
+ ],
+ 1.1
+)
const voltage: ExpressionSpecification = ['to-number', coalesce(get('voltage'), 0)]
const output: ExpressionSpecification = ['to-number', coalesce(get('output'), 0)]
@@ -167,16 +173,16 @@ const substation_radius: ExpressionSpecification = interpolate(zoom, [
])
],
[
- 12,
+ 13,
interpolate(voltage, [
[10, 1],
[30, 3],
- [100, 5],
- [300, 7],
- [600, 9]
+ [100, 4],
+ [300, 6],
+ [500, 8]
])
],
- [15, 3]
+ [20, 5]
])
// Determine the minimum zoom a point is visible at (before it can be seen as an
@@ -435,9 +441,12 @@ const layers: LayerSpecificationWithZIndex[] = [
minzoom: 8,
'source-layer': 'power_plant',
paint: {
- 'line-color': rgb(80, 80, 80),
- 'line-opacity': 0.4,
- 'line-width': 1
+ 'line-color': rgb(30, 30, 30),
+ 'line-opacity': 0.8,
+ 'line-width': interpolate(zoom, [
+ [13, 0.5],
+ [20, 2]
+ ])
},
layout: {
'line-join': 'round'
@@ -453,8 +462,11 @@ const layers: LayerSpecificationWithZIndex[] = [
'source-layer': 'power_plant',
paint: {
'line-color': rgb(163, 139, 16),
- 'line-opacity': 0.4,
- 'line-width': 1,
+ 'line-opacity': 0.8,
+ 'line-width': interpolate(zoom, [
+ [13, 1],
+ [20, 3]
+ ]),
'line-dasharray': [2, 2]
},
layout: {
@@ -471,12 +483,28 @@ const layers: LayerSpecificationWithZIndex[] = [
minzoom: 13,
paint: {
'fill-opacity': 0.3,
- 'fill-color': voltage_color('voltage'),
- 'fill-outline-color': rgb(0, 0, 0)
+ 'fill-color': voltage_color('voltage')
}
},
{
zorder: 162,
+ id: 'power_substation_outline',
+ type: 'line',
+ filter: substation_visible_p,
+ source: 'power',
+ 'source-layer': 'power_substation',
+ minzoom: 13,
+ paint: {
+ 'line-color': rgb(30, 30, 30),
+ 'line-opacity': 0.9,
+ 'line-width': interpolate(zoom, [
+ [13, 0.5],
+ [20, 2]
+ ])
+ }
+ },
+ {
+ zorder: 163,
id: 'power_solar_panel',
type: 'fill',
source: 'power',
@@ -554,7 +582,12 @@ const layers: LayerSpecificationWithZIndex[] = [
minzoom: 14,
paint: text_paint,
layout: {
- 'icon-image': 'power_transformer'
+ 'icon-image': 'power_transformer',
+ 'icon-allow-overlap': true,
+ 'icon-size': interpolate(zoom, [
+ [14, 0.3],
+ [21, 2]
+ ])
}
},
{
@@ -566,7 +599,8 @@ const layers: LayerSpecificationWithZIndex[] = [
minzoom: 14,
paint: text_paint,
layout: {
- 'icon-image': 'power_compensator'
+ 'icon-image': 'power_compensator',
+ 'icon-allow-overlap': true
}
},
{
@@ -578,7 +612,12 @@ const layers: LayerSpecificationWithZIndex[] = [
minzoom: 14,
paint: text_paint,
layout: {
- 'icon-image': 'power_switch'
+ 'icon-image': 'power_switch',
+ 'icon-size': interpolate(zoom, [
+ [14, 0.3],
+ [21, 2.5]
+ ]),
+ 'icon-allow-overlap': true
}
},
{
@@ -600,14 +639,23 @@ const layers: LayerSpecificationWithZIndex[] = [
),
'icon-offset': if_(any(has('transformer'), has('substation')), literal([12, 0]), literal([0, 0])),
'icon-allow-overlap': true,
- 'icon-size': interpolate(zoom, [
- [13, 0.6],
- [17, 1]
- ]),
+ 'icon-size': interpolate(
+ zoom,
+ [
+ [13, 0.6],
+ [21, 2.5]
+ ],
+ 1.2
+ ),
'text-field': step(zoom, '', [[14, get('ref')]]),
'text-font': font,
+ 'text-size': interpolate(zoom, [
+ [13, 8],
+ [21, 14]
+ ]),
'text-offset': [0, 1.5],
- 'text-max-angle': 10
+ 'text-max-angle': 10,
+ 'text-optional': true
}
},
{
@@ -635,7 +683,10 @@ const layers: LayerSpecificationWithZIndex[] = [
]),
'text-field': '{ref}',
'text-font': font,
- 'text-size': step(zoom, 10, [[0, 14]]),
+ 'text-size': interpolate(zoom, [
+ [13, 8],
+ [21, 14]
+ ]),
'text-offset': [0, 1],
'text-max-angle': 10
}
@@ -654,13 +705,14 @@ const layers: LayerSpecificationWithZIndex[] = [
'icon-anchor': 'bottom',
'icon-size': interpolate(zoom, [
[11, 0.5],
- [14, 1]
+ [21, 3]
]),
- 'text-field': '{name}',
+ 'icon-allow-overlap': true,
+ 'text-field': step(zoom, '', [[12, get('name')]]),
'text-font': font,
- 'text-size': step(zoom, 0, [[12, 9]]),
'text-offset': [0, 1],
- 'text-anchor': 'top'
+ 'text-anchor': 'top',
+ 'text-optional': true
}
},
{
@@ -689,7 +741,7 @@ const layers: LayerSpecificationWithZIndex[] = [
paint: {
'circle-radius': substation_radius,
'circle-color': voltage_color('voltage'),
- 'circle-stroke-color': '#555',
+ 'circle-stroke-color': '#333',
'circle-stroke-width': interpolate(zoom, [
[5, 0.1],
[8, 0.5],
@@ -783,7 +835,7 @@ const layers: LayerSpecificationWithZIndex[] = [
'text-offset': [0, -0.5],
'text-size': interpolate(zoom, [
[14, 9],
- [18, 12]
+ [21, 14]
]),
'text-max-width': 8
},
diff --git a/web/src/style/style_oim_water.ts b/web/src/style/style_oim_water.ts
index 2bda39d..cc6a302 100644
--- a/web/src/style/style_oim_water.ts
+++ b/web/src/style/style_oim_water.ts
@@ -139,8 +139,7 @@ const layers: LayerSpecificationWithZIndex[] = [
minzoom: 4,
'source-layer': 'water_reservoir',
paint: {
- 'fill-color': reservoir_colour,
- 'fill-antialias': true
+ 'fill-color': reservoir_colour
}
},
{