Skip to content

Open Infrastructure Map, a view of infrastructure data in OpenStreetMap

Fix transformer label when no voltage

Russ Garrettf1accda87a44
diff --git a/web/src/style/style_oim_power.ts b/web/src/style/style_oim_power.ts
index 7fb6720..5991c05 100644
--- a/web/src/style/style_oim_power.ts
+++ b/web/src/style/style_oim_power.ts
@@ -320,10 +320,16 @@ const line_voltage: ExpressionSpecification = case_(
)
const transformer_label: ExpressionSpecification = concat(
- round(['to-number', get('voltage_primary')], 3),
- if_(['has', 'voltage_secondary'], concat('/', round(['to-number', get('voltage_secondary')], 3)), ''),
- if_(['has', 'voltage_tertiary'], concat('/', round(['to-number', get('voltage_tertiary')], 3)), ''),
- ' kV',
+ if_(
+ has('voltage_primary'),
+ concat(
+ round(['to-number', get('voltage_primary')], 3),
+ if_(has('voltage_secondary'), concat('/', round(['to-number', get('voltage_secondary')], 3)), ''),
+ if_(has('voltage_tertiary'), concat('/', round(['to-number', get('voltage_tertiary')], 3)), ''),
+ ' kV'
+ ),
+ ''
+ ),
if_(has('rating'), concat('\n', get('rating')), '')
)