Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Improve power label ordering

Russ Garrettc7e17e75d0a4
diff --git a/src/style_oim_power.js b/src/style_oim_power.js
index 599fd44..bee0574 100644
--- a/src/style_oim_power.js
+++ b/src/style_oim_power.js
@@ -447,6 +447,42 @@ const layers = [
'circle-stroke-width': 1
},
},
+ {
+ id: 'power_line_ref',
+ type: 'symbol',
+ filter: ['all',
+ power_visible_p,
+ ['!=', ['coalesce', ['get', 'ref'], ''], ''],
+ ['<', ['length', ['get', 'ref']], 5]
+ ],
+ source: 'openinframap',
+ 'source-layer': 'power_line',
+ minzoom: 10,
+ layout: {
+ 'icon-image': 'power_line_ref',
+ 'text-field': '{ref}',
+ 'symbol-placement': 'line-center',
+ 'text-size': 10,
+ 'text-max-angle': 10
+ }
+ },
+ {
+ id: 'power_line_label',
+ type: 'symbol',
+ filter: ['all', power_visible_p],
+ source: 'openinframap',
+ 'source-layer': 'power_line',
+ minzoom: 11,
+ paint: text_paint,
+ layout: {
+ 'text-field': line_label,
+ 'symbol-placement': 'line',
+ 'symbol-spacing': 400,
+ 'text-size': 10,
+ 'text-offset': [0, 1],
+ 'text-max-angle': 10
+ }
+ },
{
id: 'power_substation_label',
type: 'symbol',
@@ -494,42 +530,6 @@ const layers = [
],
}),
},
- {
- id: 'power_line_ref',
- type: 'symbol',
- filter: ['all',
- power_visible_p,
- ['!=', ['coalesce', ['get', 'ref'], ''], ''],
- ['<', ['length', ['get', 'ref']], 5]
- ],
- source: 'openinframap',
- 'source-layer': 'power_line',
- minzoom: 10,
- layout: {
- 'icon-image': 'power_line_ref',
- 'text-field': '{ref}',
- 'symbol-placement': 'line-center',
- 'text-size': 10,
- 'text-max-angle': 10
- }
- },
- {
- id: 'power_line_label',
- type: 'symbol',
- filter: ['all', power_visible_p],
- source: 'openinframap',
- 'source-layer': 'power_line',
- minzoom: 11,
- paint: text_paint,
- layout: {
- 'text-field': line_label,
- 'symbol-placement': 'line',
- 'symbol-spacing': 400,
- 'text-size': 10,
- 'text-offset': [0, 1],
- 'text-max-angle': 10
- }
- },
];
export default layers;