Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Pole transformer/switch refactor

Russ Garrett57025755181f
diff --git a/web/src/icons/power_pole_transformer.svg b/web/src/icons/power_pole_transformer.svg
deleted file mode 100644
index 0b5edcf..0000000
--- a/web/src/icons/power_pole_transformer.svg
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0" y="0" width="31" height="30" viewBox="0, 0, 31, 30">
- <g id="Layer_1">
- <path d="M5.641,19.469 C3.173,19.469 1.172,17.468 1.172,15 C1.172,12.532 3.173,10.531 5.641,10.531 C8.109,10.531 10.11,12.532 10.11,15 C10.11,17.468 8.109,19.469 5.641,19.469 z" fill="#775211"/>
- <path d="M5.641,19.469 C3.173,19.469 1.172,17.468 1.172,15 C1.172,12.532 3.173,10.531 5.641,10.531 C8.109,10.531 10.11,12.532 10.11,15 C10.11,17.468 8.109,19.469 5.641,19.469 z" fill-opacity="0" stroke="#000000" stroke-width="1"/>
- <g id="power_transformer">
- <g>
- <path d="M20.918,28.875 C16.01,28.875 12.032,24.897 12.032,19.989 C12.032,15.08 16.01,11.102 20.918,11.102 C25.826,11.102 29.805,15.08 29.805,19.989 C29.805,24.897 25.826,28.875 20.918,28.875 z" fill="#FFFFFF"/>
- <path d="M20.918,28.875 C16.01,28.875 12.032,24.897 12.032,19.989 C12.032,15.08 16.01,11.102 20.918,11.102 C25.826,11.102 29.805,15.08 29.805,19.989 C29.805,24.897 25.826,28.875 20.918,28.875 z" fill-opacity="0" stroke="#3B3B3B" stroke-width="1"/>
- </g>
- <g>
- <path d="M20.918,18.898 C16.01,18.898 12.032,14.92 12.032,10.013 C12.032,5.105 16.01,1.125 20.918,1.125 C25.826,1.125 29.805,5.105 29.805,10.013 C29.805,14.92 25.826,18.898 20.918,18.898 z" fill="#FFFFFF"/>
- <path d="M20.918,18.898 C16.01,18.898 12.032,14.92 12.032,10.013 C12.032,5.105 16.01,1.125 20.918,1.125 C25.826,1.125 29.805,5.105 29.805,10.013 C29.805,14.92 25.826,18.898 20.918,18.898 z" fill-opacity="0" stroke="#3B3B3B" stroke-width="1"/>
- </g>
- <path d="M24.49,2.3" fill-opacity="0" stroke="#3B3B3B" stroke-width="1"/>
- <path d="M20.918,28.875 C16.01,28.875 12.032,24.897 12.032,19.989 C12.032,15.08 16.01,11.102 20.918,11.102 C25.826,11.102 29.805,15.08 29.805,19.989 C29.805,24.897 25.826,28.875 20.918,28.875 z" fill-opacity="0" stroke="#3B3B3B" stroke-width="1"/>
- </g>
- </g>
-</svg>
diff --git a/web/src/style/style_oim_power.ts b/web/src/style/style_oim_power.ts
index cbae94d..7fb6720 100644
--- a/web/src/style/style_oim_power.ts
+++ b/web/src/style/style_oim_power.ts
@@ -731,14 +731,7 @@ const layers: LayerSpecificationWithZIndex[] = [
minzoom: 13,
paint: text_paint,
layout: {
- 'icon-image': case_(
- [
- [get('transition'), 'power_tower_transition'],
- [any(has('transformer'), has('substation')), 'power_tower_transformer']
- ],
- 'power_tower'
- ),
- 'icon-offset': if_(any(has('transformer'), has('substation')), literal([12, 0]), literal([0, 0])),
+ 'icon-image': case_([[get('transition'), 'power_tower_transition']], 'power_tower'),
'icon-allow-overlap': true,
'icon-size': interpolate(
zoom,
@@ -769,27 +762,68 @@ const layers: LayerSpecificationWithZIndex[] = [
minzoom: 13,
paint: text_paint,
layout: {
- 'icon-image': case_(
- [
- [get('transition'), 'power_pole_transition'],
- [any(has('transformer'), has('substation')), 'power_pole_transformer']
- ],
- 'power_pole'
- ),
- 'icon-offset': if_(any(has('transformer'), has('substation')), literal([10, 0]), literal([0, 0])),
+ 'icon-image': case_([[get('transition'), 'power_pole_transition']], 'power_pole'),
'icon-allow-overlap': true,
'icon-size': interpolate(zoom, [
[13, 0.2],
[17, 0.8]
]),
- 'text-field': '{ref}',
+ 'text-field': step(zoom, '', [[15, get('name')]]),
'text-font': font,
'text-size': interpolate(zoom, [
[13, 8],
[21, 14]
]),
- 'text-offset': [0, 1],
- 'text-max-angle': 10
+ 'text-offset': interpolate(zoom, [
+ [15, literal([0, 2.5])],
+ [21, literal([0, 4])]
+ ]),
+ 'text-max-angle': 10,
+ 'text-optional': true
+ }
+ },
+ {
+ zorder: 266,
+ id: 'power_pole_transformer',
+ type: 'symbol',
+ filter: any(has('transformer'), has('substation')),
+ source: 'power',
+ 'source-layer': 'power_tower',
+ minzoom: 13,
+ layout: {
+ 'icon-image': 'power_transformer',
+ 'icon-offset': [45, 0],
+ 'icon-size': interpolate(zoom, [
+ [13, 0.1],
+ [21, 0.5]
+ ]),
+ 'icon-allow-overlap': true
+ }
+ },
+ {
+ zorder: 266,
+ id: 'power_pole_switch',
+ type: 'symbol',
+ filter: has('switch'),
+ source: 'power',
+ 'source-layer': 'power_tower',
+ minzoom: 13,
+ layout: {
+ 'icon-image': match(
+ get('switch'),
+ [
+ ['disconnector', 'power_switch_disconnector'],
+ ['circuit_breaker', 'power_switch_circuit_breaker']
+ ],
+ 'power_switch'
+ ),
+ 'icon-rotate': 270,
+ 'icon-offset': [0, -20],
+ 'icon-size': interpolate(zoom, [
+ [13, 0.2],
+ [21, 1]
+ ]),
+ 'icon-allow-overlap': true
}
},
oimSymbol({