Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Power pole/tower rendering tweaks and transformer icons

Russ Garrett1b28bf65de5f
diff --git a/sprites/power_pole.svg b/sprites/power_pole.svg
index cb7b841..3c8619d 100644
--- a/sprites/power_pole.svg
+++ b/sprites/power_pole.svg
@@ -2,8 +2,9 @@
<!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="10" height="10" viewBox="0, 0, 10, 10">
<g id="Layer_1">
+ <path d="M5.5,9.969 C3.032,9.969 1.031,7.968 1.031,5.5 C1.031,3.032 3.032,1.031 5.5,1.031 C7.968,1.031 9.969,3.032 9.969,5.5 C9.969,7.968 7.968,9.969 5.5,9.969 z" fill="#775211"/>
<g>
- <path d="M5.5,9.969 C3.032,9.969 1.031,7.968 1.031,5.5 C1.031,3.032 3.032,1.031 5.5,1.031 C7.968,1.031 9.969,3.032 9.969,5.5 C9.969,7.968 7.968,9.969 5.5,9.969 z" fill="#5A3F10"/>
+ <path d="M5.5,9.969 C3.032,9.969 1.031,7.968 1.031,5.5 C1.031,3.032 3.032,1.031 5.5,1.031 C7.968,1.031 9.969,3.032 9.969,5.5 C9.969,7.968 7.968,9.969 5.5,9.969 z" fill="#775211"/>
<path d="M5.5,9.969 C3.032,9.969 1.031,7.968 1.031,5.5 C1.031,3.032 3.032,1.031 5.5,1.031 C7.968,1.031 9.969,3.032 9.969,5.5 C9.969,7.968 7.968,9.969 5.5,9.969 z" fill-opacity="0" stroke="#000000" stroke-width="1"/>
</g>
</g>
diff --git a/sprites/power_pole_transformer.svg b/sprites/power_pole_transformer.svg
new file mode 100644
index 0000000..0b5edcf
--- /dev/null
+++ b/sprites/power_pole_transformer.svg
@@ -0,0 +1,20 @@
+<?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/sprites/power_tower_transformer.svg b/sprites/power_tower_transformer.svg
new file mode 100644
index 0000000..9bd2956
--- /dev/null
+++ b/sprites/power_tower_transformer.svg
@@ -0,0 +1,25 @@
+<?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="36" height="30" viewBox="0, 0, 36, 30">
+ <g id="Background"/>
+ <g id="Layer_1">
+ <g>
+ <path d="M1.094,21.447 L1.093,8.572 L13.969,8.571 L13.969,21.446 z" fill="#FFFFFF"/>
+ <path d="M1.094,21.447 L1.093,8.572 L13.969,8.571 L13.969,21.446 z" fill-opacity="0" stroke="#3B3B3B" stroke-width="2" stroke-linejoin="bevel"/>
+ </g>
+ <path d="M0.267,8.891 L13.587,21.978 L14.517,21.064 L1.197,7.978 z" fill="#3B3B3B"/>
+ <path d="M13.595,7.978 L0.392,21.064 L1.313,21.978 L14.517,8.891 z" fill="#3B3B3B"/>
+ <g id="power_transformer">
+ <g>
+ <path d="M26.741,28.776 C21.871,28.776 17.923,24.829 17.923,19.959 C17.923,15.089 21.871,11.141 26.741,11.141 C31.611,11.141 35.559,15.089 35.559,19.959 C35.559,24.829 31.611,28.776 26.741,28.776 z" fill="#FFFFFF"/>
+ <path d="M26.741,28.776 C21.871,28.776 17.923,24.829 17.923,19.959 C17.923,15.089 21.871,11.141 26.741,11.141 C31.611,11.141 35.559,15.089 35.559,19.959 C35.559,24.829 31.611,28.776 26.741,28.776 z" fill-opacity="0" stroke="#3B3B3B" stroke-width="1"/>
+ </g>
+ <g>
+ <path d="M26.741,18.877 C21.871,18.877 17.923,14.929 17.923,10.06 C17.923,5.19 21.871,1.242 26.741,1.242 C31.611,1.242 35.559,5.19 35.559,10.06 C35.559,14.929 31.611,18.877 26.741,18.877 z" fill="#FFFFFF"/>
+ <path d="M26.741,18.877 C21.871,18.877 17.923,14.929 17.923,10.06 C17.923,5.19 21.871,1.242 26.741,1.242 C31.611,1.242 35.559,5.19 35.559,10.06 C35.559,14.929 31.611,18.877 26.741,18.877 z" fill-opacity="0" stroke="#3B3B3B" stroke-width="1"/>
+ </g>
+ <path d="M30.285,2.407" fill-opacity="0" stroke="#3B3B3B" stroke-width="1"/>
+ <path d="M26.741,28.776 C21.871,28.776 17.923,24.829 17.923,19.959 C17.923,15.089 21.871,11.141 26.741,11.141 C31.611,11.141 35.559,15.089 35.559,19.959 C35.559,24.829 31.611,28.776 26.741,28.776 z" fill-opacity="0" stroke="#3B3B3B" stroke-width="1"/>
+ </g>
+ </g>
+</svg>
diff --git a/src/style/style_oim_power.js b/src/style/style_oim_power.js
index feec892..246506e 100644
--- a/src/style/style_oim_power.js
+++ b/src/style/style_oim_power.js
@@ -629,9 +629,18 @@ const layers = [
'case',
['get', 'transition'],
'power_tower_transition',
+ ['has', 'transformer'],
+ 'power_tower_transformer',
'power_tower',
],
- 'icon-size': ['interpolate', ['linear'], ['zoom'], 13, 0.4, 17, 1],
+ 'icon-offset': [
+ 'case',
+ ['has', 'transformer'],
+ ['literal', [12, 0]],
+ ['literal', [0, 0]]
+ ],
+ 'icon-allow-overlap': true,
+ 'icon-size': ['interpolate', ['linear'], ['zoom'], 13, 0.6, 17, 1],
'text-field': '{ref}',
'text-size': [
'step',
@@ -652,16 +661,25 @@ const layers = [
filter: ['==', ['get', 'type'], 'pole'],
source: 'openinframap',
'source-layer': 'power_tower',
- minzoom: 14,
+ minzoom: 13,
paint: text_paint,
layout: {
'icon-image': [
'case',
['get', 'transition'],
'power_pole_transition',
+ ['has', 'transformer'],
+ 'power_pole_transformer',
'power_pole',
],
- 'icon-size': 0.5,
+ 'icon-offset': [
+ 'case',
+ ['has', 'transformer'],
+ ['literal', [10, 0]],
+ ['literal', [0, 0]]
+ ],
+ 'icon-allow-overlap': true,
+ 'icon-size': ['interpolate', ['linear'], ['zoom'], 13, 0.2, 17, 0.8],
'text-field': '{ref}',
'text-size': [
'step',