From c3d60cfbf562aaad6e4544402745ec657319ea5f Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Sun, 17 Nov 2024 11:36:02 +0100 Subject: [PATCH 1/3] Improve signal features rendering (#149) Changes: - Show references for speed and electrification signals - Fix sizes of some icons - Merge layers of symbol text into same layer as the icons. --- import/sql/tile_views.sql | 6 +- martin/configuration.yml | 2 + proxy/js/styles.mjs | 121 +++++++++++++++++-------------------- proxy/js/ui.js | 1 - symbols/de/bostrab/f0.svg | 2 +- symbols/de/bostrab/f1.svg | 2 +- symbols/de/bostrab/f2.svg | 2 +- symbols/de/bostrab/f3.svg | 10 +-- symbols/de/bostrab/f5.svg | 10 +-- symbols/de/hl0.svg | 6 +- symbols/de/hl1-distant.svg | 14 ++--- symbols/de/hl1.svg | 6 +- symbols/de/hl10.svg | 6 +- symbols/de/hl11.svg | 18 +++--- symbols/de/hl12a.svg | 8 +-- symbols/de/hl12b.svg | 18 +++--- symbols/de/hl2.svg | 18 +++--- symbols/de/hl3a.svg | 8 +-- symbols/de/hl3b.svg | 18 +++--- 19 files changed, 134 insertions(+), 142 deletions(-) diff --git a/import/sql/tile_views.sql b/import/sql/tile_views.sql index 870a6d2c..1ee5e7b1 100644 --- a/import/sql/tile_views.sql +++ b/import/sql/tile_views.sql @@ -282,7 +282,8 @@ CREATE OR REPLACE VIEW speed_railway_signals AS speed_feature as feature, speed_feature_type as type, azimuth, - (signal_direction = 'both') as direction_both + (signal_direction = 'both') as direction_both, + ref FROM signals_with_azimuth WHERE railway = 'signal' AND speed_feature IS NOT NULL @@ -346,7 +347,8 @@ CREATE OR REPLACE VIEW electrification_signals AS way, electrification_feature as feature, azimuth, - (signal_direction = 'both') as direction_both + (signal_direction = 'both') as direction_both, + ref FROM signals_with_azimuth WHERE railway = 'signal' diff --git a/martin/configuration.yml b/martin/configuration.yml index ce7717a5..fffc2a6b 100644 --- a/martin/configuration.yml +++ b/martin/configuration.yml @@ -243,6 +243,7 @@ postgres: id: integer feature: string type: string + ref: string azimuth: number direction_both: boolean @@ -279,6 +280,7 @@ postgres: feature: string azimuth: number direction_both: boolean + ref: string functions: diff --git a/proxy/js/styles.mjs b/proxy/js/styles.mjs index fb810997..24c99fa7 100644 --- a/proxy/js/styles.mjs +++ b/proxy/js/styles.mjs @@ -2256,9 +2256,23 @@ const layers = { 16, ['!=', ['get', 'feature'], null], ], + paint: { + 'text-halo-color': ['case', + ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, + 'white' + ], + 'text-halo-width': 1.5, + 'text-halo-blur': 1, + }, layout: { 'symbol-z-order': 'source', 'icon-overlap': 'always', + 'text-field': '{ref}', + 'text-font': ['Noto Sans Medium'], + 'text-size': 9, + 'text-optional': true, + 'text-anchor': 'top', + 'text-offset': ['literal', [0, 1.5]], }, }, ), @@ -2301,7 +2315,7 @@ const layers = { 'text-font': ['Noto Sans Bold'], 'text-size': 11, 'text-padding': 30, - 'symbol-spacing': 100, + 'symbol-spacing': 200, }, }, searchResults, @@ -2503,9 +2517,35 @@ const layers = { minzoom: 16, source: 'openrailwaymap_signals', 'source-layer': 'signals_railway_signals', + paint: { + 'text-halo-color': ['case', + ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, + 'white' + ], + 'text-halo-width': ['case', + ['==', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], 2.0, + 1.5, + ], + 'text-halo-blur': 1, + }, layout: { 'symbol-z-order': 'source', 'icon-overlap': 'always', + 'text-field': ['case', + ['==', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], ['get', 'ref_multiline'], + ['get', 'ref'], + ], + 'text-font': ['Noto Sans Medium'], + 'text-size': 9, + 'text-optional': true, + 'text-anchor': ['case', + ['==', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], 'center', + 'top', + ], + 'text-offset': ['case', + ['==', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], ['literal', [0, 0]], + ['literal', [0, 1.5]], + ], }, }, ), @@ -2565,71 +2605,6 @@ const layers = { 'text-size': 11, } }, - { - id: 'railway_signals_blockkennzeichen_text', - type: 'symbol', - minzoom: 16, - source: 'openrailwaymap_signals', - 'source-layer': 'signals_railway_signals', - filter: ['all', - ['!=', ['get', 'ref_multiline'], null], - ['==', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], - ], - paint: { - 'text-halo-color': ['case', - ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, - 'white' - ], - 'text-halo-width': 2, - }, - layout: { - 'text-field': '{ref_multiline}', - 'text-font': ['Noto Sans Bold'], - 'text-size': 9, - 'text-anchor': 'center', - 'text-overlap': 'always', - }, - }, - { - id: 'railway_signals_text', - type: 'symbol', - minzoom: 13, - source: 'openrailwaymap_signals', - 'source-layer': 'signals_railway_signals', - filter: ['all', - ['!=', ['get', 'ref'], null], - ['!=', ['get', 'feature'], ''], - ['!=', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], - ], - paint: { - 'text-halo-color': ['case', - ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, - 'white' - ], - 'text-halo-width': 1.5, - 'text-halo-blur': 1, - }, - layout: { - 'text-field': '{ref}', - 'text-font': ['Noto Sans Medium'], - 'text-size': 9, - 'text-anchor': 'top', - 'text-offset': ['case', - ['==', ['get', 'main_height'], 'dwarf'], ['literal', [0, 1]], - ['any', - ['all', - ['==', ['get', 'main_form'], 'light'], - ['==', ['get', 'speed_limit_form'], 'light'], - ], - ['all', - ['==', ['get', 'distant_form'], 'light'], - ['==', ['get', 'speed_limit_form'], 'light'], - ], - ], ['literal', [0, 2]], - ['literal', [0, 1.5]], - ], - } - }, searchResults, ], @@ -2759,9 +2734,23 @@ const layers = { minzoom: 15, source: 'openrailwaymap_electrification', 'source-layer': 'electrification_signals', + paint: { + 'text-halo-color': ['case', + ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, + 'white' + ], + 'text-halo-width': 1.5, + 'text-halo-blur': 1, + }, layout: { 'symbol-z-order': 'source', 'icon-overlap': 'always', + 'text-field': '{ref}', + 'text-font': ['Noto Sans Medium'], + 'text-size': 9, + 'text-optional': true, + 'text-anchor': 'top', + 'text-offset': ['literal', [0, 1.5]], }, }, ), diff --git a/proxy/js/ui.js b/proxy/js/ui.js index 0ef0bc76..d9c17fa0 100644 --- a/proxy/js/ui.js +++ b/proxy/js/ui.js @@ -668,7 +668,6 @@ function popupContent(properties) { ${properties.tunnel === true ? `tunnel` : ''} ${properties.bridge === true ? `bridge` : ''} ${properties.railway_local_operated === true ? `operated locally` : ''} - ${properties.maxspeed ? `maximum speed: ${properties.maxspeed} km/h` : ''} ${properties.track_class ? `track class: ${properties.track_class}` : ''} ${properties.direction_both ? `both directions` : ''} ${properties.train_protection ? `train protection: ${properties.train_protection}` : ''} diff --git a/symbols/de/bostrab/f0.svg b/symbols/de/bostrab/f0.svg index e960eb2a..bfa9d5cb 100644 --- a/symbols/de/bostrab/f0.svg +++ b/symbols/de/bostrab/f0.svg @@ -1,6 +1,6 @@ - + diff --git a/symbols/de/bostrab/f1.svg b/symbols/de/bostrab/f1.svg index 1d92f41b..dbc46144 100644 --- a/symbols/de/bostrab/f1.svg +++ b/symbols/de/bostrab/f1.svg @@ -1,6 +1,6 @@ - + diff --git a/symbols/de/bostrab/f2.svg b/symbols/de/bostrab/f2.svg index c59011d5..4f9c9d19 100644 --- a/symbols/de/bostrab/f2.svg +++ b/symbols/de/bostrab/f2.svg @@ -1,6 +1,6 @@ - + diff --git a/symbols/de/bostrab/f3.svg b/symbols/de/bostrab/f3.svg index 7a12fb9d..5627f3db 100644 --- a/symbols/de/bostrab/f3.svg +++ b/symbols/de/bostrab/f3.svg @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/symbols/de/bostrab/f5.svg b/symbols/de/bostrab/f5.svg index 8a17f72f..daac9713 100644 --- a/symbols/de/bostrab/f5.svg +++ b/symbols/de/bostrab/f5.svg @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/symbols/de/hl0.svg b/symbols/de/hl0.svg index 4e56b085..3eb434f5 100644 --- a/symbols/de/hl0.svg +++ b/symbols/de/hl0.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/symbols/de/hl1-distant.svg b/symbols/de/hl1-distant.svg index 37ca6e2d..883e666f 100644 --- a/symbols/de/hl1-distant.svg +++ b/symbols/de/hl1-distant.svg @@ -1,9 +1,9 @@ - - - - - - - + + + + + + + diff --git a/symbols/de/hl1.svg b/symbols/de/hl1.svg index bdbfdef5..e87c3fac 100644 --- a/symbols/de/hl1.svg +++ b/symbols/de/hl1.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/symbols/de/hl10.svg b/symbols/de/hl10.svg index 2937ab59..5faaffc4 100644 --- a/symbols/de/hl10.svg +++ b/symbols/de/hl10.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/symbols/de/hl11.svg b/symbols/de/hl11.svg index 4f437e47..7d37c364 100644 --- a/symbols/de/hl11.svg +++ b/symbols/de/hl11.svg @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + diff --git a/symbols/de/hl12a.svg b/symbols/de/hl12a.svg index e5d3cb88..c9083a80 100644 --- a/symbols/de/hl12a.svg +++ b/symbols/de/hl12a.svg @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/symbols/de/hl12b.svg b/symbols/de/hl12b.svg index 2fa134b0..c026be4a 100644 --- a/symbols/de/hl12b.svg +++ b/symbols/de/hl12b.svg @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + diff --git a/symbols/de/hl2.svg b/symbols/de/hl2.svg index ec5d2a5b..707ae2f1 100644 --- a/symbols/de/hl2.svg +++ b/symbols/de/hl2.svg @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + diff --git a/symbols/de/hl3a.svg b/symbols/de/hl3a.svg index dba15352..830701c4 100644 --- a/symbols/de/hl3a.svg +++ b/symbols/de/hl3a.svg @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/symbols/de/hl3b.svg b/symbols/de/hl3b.svg index e2d1bca6..cf849012 100644 --- a/symbols/de/hl3b.svg +++ b/symbols/de/hl3b.svg @@ -1,11 +1,11 @@ - - - - - - - - - + + + + + + + + + From a0bdbb725752dce04f605efa3863a28a2c9ba62b Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Thu, 21 Nov 2024 07:47:46 +0100 Subject: [PATCH 2/3] Fix track class D4L tagged as DL (#150) From https://github.com/hiddewie/OpenRailwayMap-vector/issues/103#issuecomment-2489655071 The list should be as documented in https://wiki.openstreetmap.org/wiki/Key:railway:track_class --- features/track_class.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features/track_class.yaml b/features/track_class.yaml index 36eaffdc..12418027 100644 --- a/features/track_class.yaml +++ b/features/track_class.yaml @@ -13,7 +13,7 @@ track_classes: - { value: 'D2', color: 'hsl(30, 100%, 40%)' } - { value: 'D3', color: 'hsl(20, 100%, 40%)' } - { value: 'D4', color: 'hsl(10, 100%, 40%)' } - - { value: 'DL', color: 'hsl(0, 100%, 40%)' } + - { value: 'D4L', color: 'hsl(0, 100%, 40%)' } - { value: 'E4', color: 'hsl(340, 100%, 40%)' } - { value: 'E5', color: 'hsl(320, 100%, 40%)' } - { value: 'F', color: 'hsl(300, 100%, 40%)' } From 2eff8ace6f25297425614ca475720966407657ac Mon Sep 17 00:00:00 2001 From: Hidde Wieringa Date: Sun, 24 Nov 2024 15:57:35 +0100 Subject: [PATCH 3/3] Render VGF st9 & st10 signals (#151) See https://wiki.openstreetmap.org/wiki/DE_talk:OpenRailwayMap/Tagging_Trams_in_Germany The tagging for `st10` is still under discussion In Frankfurt (http://localhost:8000/#view=17.38/50.149771/8.666253&style=electrification) ![image](https://github.com/user-attachments/assets/89e89fa0-1c48-44b3-b4ac-9ac7eeb11463) --- features/electrification_signals.yaml | 21 +++++++++++++++++++++ symbols/de/vgf/st10.svg | 6 ++++++ symbols/de/vgf/st9-st10.svg | 23 +++++++++++++++++++++++ symbols/de/vgf/st9.svg | 20 ++++++++++++++++++++ 4 files changed, 70 insertions(+) create mode 100644 symbols/de/vgf/st10.svg create mode 100644 symbols/de/vgf/st9-st10.svg create mode 100644 symbols/de/vgf/st9.svg diff --git a/features/electrification_signals.yaml b/features/electrification_signals.yaml index 844ed1ad..2bc9e0b0 100644 --- a/features/electrification_signals.yaml +++ b/features/electrification_signals.yaml @@ -383,6 +383,27 @@ electrification_signals: - { tag: 'railway:signal:electricity:type', value: 'power_on_for_long_trains' } - { tag: 'railway:signal:electricity:form', value: 'sign' } + - description: VGF st9 + country: DE + icon: { default: 'de/vgf/st9' } + tags: + - { tag: 'railway:signal:electricity:form', value: 'sign' } + - { tag: 'railway:signal:electricity', value: 'DE-VGF:st9' } + + - description: VGF st10 + country: DE + icon: { default: 'de/vgf/st10' } + tags: + - { tag: 'railway:signal:electricity:form', value: 'sign' } + - { tag: 'railway:signal:electricity', value: 'DE-VGF:st10' } + + - description: VGF st9 & st10 + country: DE + icon: { default: 'de/vgf/st9-st10' } + tags: + - { tag: 'railway:signal:electricity:form', value: 'sign' } + - { tag: 'railway:signal:electricity', value: 'DE-VGF:st9;DE-VGF:st10' } + # --- ES --- # - description: end of catenary diff --git a/symbols/de/vgf/st10.svg b/symbols/de/vgf/st10.svg new file mode 100644 index 00000000..233b4eca --- /dev/null +++ b/symbols/de/vgf/st10.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/symbols/de/vgf/st9-st10.svg b/symbols/de/vgf/st9-st10.svg new file mode 100644 index 00000000..6ddffd7d --- /dev/null +++ b/symbols/de/vgf/st9-st10.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/symbols/de/vgf/st9.svg b/symbols/de/vgf/st9.svg new file mode 100644 index 00000000..92a3e40c --- /dev/null +++ b/symbols/de/vgf/st9.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + +