diff --git a/docker-compose.yml b/docker-compose.yml index 22494b81..1fc540a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -44,7 +44,7 @@ services: - OSM2PGSQL_DATAFILE martin-cp: - image: ghcr.io/maplibre/martin + image: ghcr.io/maplibre/martin:main depends_on: db: condition: service_healthy diff --git a/features/signals_railway_signals.yaml b/features/signals_railway_signals.yaml index cbb42dc5..5bcc2816 100644 --- a/features/signals_railway_signals.yaml +++ b/features/signals_railway_signals.yaml @@ -826,9 +826,18 @@ signals_railway_signals: - description: Blockkennzeichen country: DE - # TODO match width and height - # WHEN ref_width <= 4 AND ref_height <= 2 THEN CONCAT('de/blockkennzeichen-', ref_width, 'x', ref_height) - icon: { default: 'de/blockkennzeichen' } + icon: + match: 'ref_multiline' + cases: + - { regex: '^([^\n]{4}\n[^\n]{1,4})|([^\n]{1,4}\n[^\n]{4})$', value: 'de/blockkennzeichen-4x2' } + - { regex: '^[^\n]{4}$', value: 'de/blockkennzeichen-4x1' } + - { regex: '^([^\n]{3}\n[^\n]{1,3})|([^\n]{1,3}\n[^\n]{3})$', value: 'de/blockkennzeichen-3x2' } + - { regex: '^[^\n]{3}$', value: 'de/blockkennzeichen-3x1' } + - { regex: '^([^\n]{2}\n[^\n]{1,2})|([^\n]{1,2}\n[^\n]{2})$', value: 'de/blockkennzeichen-2x2' } + - { regex: '^[^\n]{2}$', value: 'de/blockkennzeichen-2x1' } + - { regex: '^[^\n]\n[^\n]$', value: 'de/blockkennzeichen-1x2' } + - { regex: '^[^\n]$', value: 'de/blockkennzeichen-1x1' } + default: 'de/blockkennzeichen' tags: - { tag: 'railway:signal:train_protection', value: 'DE-ESO:blockkennzeichen' } diff --git a/import/openrailwaymap.lua b/import/openrailwaymap.lua index f14b4597..35006e17 100644 --- a/import/openrailwaymap.lua +++ b/import/openrailwaymap.lua @@ -169,8 +169,6 @@ local signals = osm2pgsql.define_table({ { column = 'deactivated', type = 'boolean' }, { column = 'ref', type = 'text' }, { column = 'ref_multiline', type = 'text' }, - { column = 'ref_width', type = 'smallint' }, - { column = 'ref_height', type = 'smallint' }, { column = 'signal_direction', type = 'text' }, {% for tag in signals_railway_signals.tags %} { column = '{% tag %}', type = 'text' }, @@ -429,11 +427,6 @@ function osm2pgsql.process_node(object) tags['railway:signal:speed_limit:deactivated'] ) == 'yes' local ref_multiline, newline_count = (tags.ref or ''):gsub(' ', '\n') - local ref_height = newline_count + 1 - local ref_width = 0 - for part in string.gmatch(tags.ref or '', '[^ ]+') do - ref_width = math.max(ref_width, part:len()) - end signals:insert({ way = object:as_point(), @@ -442,8 +435,6 @@ function osm2pgsql.process_node(object) deactivated = deactivated, ref = tags.ref, ref_multiline = ref_multiline ~= '' and ref_multiline or nil, - ref_height = ref_multiline ~= '' and ref_height or nil, - ref_width = ref_multiline ~= '' and ref_width or nil, signal_direction = tags['railway:signal:direction'], {% for tag in signals_railway_signals.tags %} ["{% tag %}"] = tags['{% tag %}'], diff --git a/martin-static.Dockerfile b/martin-static.Dockerfile index 83bb5e76..a7271295 100644 --- a/martin-static.Dockerfile +++ b/martin-static.Dockerfile @@ -1,7 +1,7 @@ -FROM ghcr.io/maplibre/martin +FROM ghcr.io/maplibre/martin:main COPY martin /config COPY symbols /symbols COPY tiles /tiles -CMD ["/tiles", "--listen-addresses", "[::]:3000", "--sprite", "/symbols", "--font", "/config/fonts"] \ No newline at end of file +CMD ["/tiles", "--listen-addresses", "[::]:3000", "--sprite", "/symbols", "--font", "/config/fonts"] diff --git a/martin.Dockerfile b/martin.Dockerfile index 6a1bb999..bc5a074d 100644 --- a/martin.Dockerfile +++ b/martin.Dockerfile @@ -1,6 +1,6 @@ -FROM ghcr.io/maplibre/martin +FROM ghcr.io/maplibre/martin:main COPY martin /config COPY symbols /symbols -CMD ["--config", "/config/configuration.yml", "--sprite", "/symbols", "--font", "/config/fonts"] \ No newline at end of file +CMD ["--config", "/config/configuration.yml", "--sprite", "/symbols", "--font", "/config/fonts"] diff --git a/proxy/js/styles.mjs b/proxy/js/styles.mjs index 84f9c4a5..f3fda0cb 100644 --- a/proxy/js/styles.mjs +++ b/proxy/js/styles.mjs @@ -54,6 +54,9 @@ const colors = { }, }, }, + signals: { + direction: '#a8d8bcff' + } }; const turntable_casing_width = 2; @@ -561,13 +564,14 @@ const trainProtectionLayout = { 'line-join': 'round', 'line-cap': 'round', }; +const trainProtectionColor = ['case', + ['boolean', ['feature-state', 'hover'], false], colors.hover.main, + ...signals_railway_line.train_protections.flatMap(train_protection => + [['==', ['get', 'train_protection'], train_protection.train_protection], train_protection.color]), + 'grey', +]; const trainProtectionFillPaint = dashArray => ({ - 'line-color': ['case', - ['boolean', ['feature-state', 'hover'], false], colors.hover.main, - ...signals_railway_line.train_protections.flatMap(train_protection => - [['==', ['get', 'train_protection'], train_protection.train_protection], train_protection.color]), - 'grey', - ], + 'line-color': trainProtectionColor, 'line-width': railwayLineWidth, 'line-dasharray': dashArray, }); @@ -606,39 +610,40 @@ const standardMediumFillPaint = { ], 'line-width': railwayLineWidth, }; -const standardFillPaint = dashArray => ({ - 'line-color': ['case', - ['boolean', ['feature-state', 'hover'], false], ['case', - ['all', ['==', ['get', 'usage'], 'main'], ['get', 'highspeed']], colors.hover.alternative, - colors.hover.main, - ], - ['==', ['get', 'railway'], 'disused'], colors.styles.standard.disused, - ['==', ['get', 'railway'], 'abandoned'], colors.styles.standard.abandoned, - ['==', ['get', 'railway'], 'razed'], colors.styles.standard.razed, - ['==', ['get', 'feature'], 'rail'], - ['case', - ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], 'spur']], colors.styles.standard.spur, - ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], 'yard']], colors.styles.standard.yard, - ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], 'crossover']], colors.styles.standard.siding, - ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], 'siding']], colors.styles.standard.siding, - ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], null]], colors.styles.standard.no_usage, - ['==', ['get', 'usage'], 'industrial'], colors.styles.standard.industrial, - ['==', ['get', 'usage'], 'tourism'], colors.styles.standard.tourism, - ['==', ['get', 'usage'], 'branch'], colors.styles.standard.branch, - ['all', ['==', ['get', 'usage'], 'main'], ['get', 'highspeed']], colors.styles.standard.highspeed, - ['==', ['get', 'usage'], 'main'], colors.styles.standard.main, - 'rgba(255, 255, 255, 1.0)', - ], - ['==', ['get', 'feature'], 'narrow_gauge'], - ['case', - ['all', ['==', ['get', 'usage'], 'industrial'], ['==', ['get', 'service'], 'spur']], colors.styles.standard.industrial, - colors.styles.standard.narrowGauge, - ], - ['==', ['get', 'feature'], 'subway'], colors.styles.standard.subway, - ['==', ['get', 'feature'], 'light_rail'], colors.styles.standard.light_rail, - ['==', ['get', 'feature'], 'tram'], colors.styles.standard.tram, +const standardColor = ['case', + ['boolean', ['feature-state', 'hover'], false], ['case', + ['all', ['==', ['get', 'usage'], 'main'], ['get', 'highspeed']], colors.hover.alternative, + colors.hover.main, + ], + ['==', ['get', 'railway'], 'disused'], colors.styles.standard.disused, + ['==', ['get', 'railway'], 'abandoned'], colors.styles.standard.abandoned, + ['==', ['get', 'railway'], 'razed'], colors.styles.standard.razed, + ['==', ['get', 'feature'], 'rail'], + ['case', + ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], 'spur']], colors.styles.standard.spur, + ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], 'yard']], colors.styles.standard.yard, + ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], 'crossover']], colors.styles.standard.siding, + ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], 'siding']], colors.styles.standard.siding, + ['all', ['==', ['get', 'usage'], null], ['==', ['get', 'service'], null]], colors.styles.standard.no_usage, + ['==', ['get', 'usage'], 'industrial'], colors.styles.standard.industrial, + ['==', ['get', 'usage'], 'tourism'], colors.styles.standard.tourism, + ['==', ['get', 'usage'], 'branch'], colors.styles.standard.branch, + ['all', ['==', ['get', 'usage'], 'main'], ['get', 'highspeed']], colors.styles.standard.highspeed, + ['==', ['get', 'usage'], 'main'], colors.styles.standard.main, 'rgba(255, 255, 255, 1.0)', ], + ['==', ['get', 'feature'], 'narrow_gauge'], + ['case', + ['all', ['==', ['get', 'usage'], 'industrial'], ['==', ['get', 'service'], 'spur']], colors.styles.standard.industrial, + colors.styles.standard.narrowGauge, + ], + ['==', ['get', 'feature'], 'subway'], colors.styles.standard.subway, + ['==', ['get', 'feature'], 'light_rail'], colors.styles.standard.light_rail, + ['==', ['get', 'feature'], 'tram'], colors.styles.standard.tram, + 'rgba(255, 255, 255, 1.0)', +] +const standardFillPaint = dashArray => ({ + 'line-color': standardColor, 'line-width': railwayLineWidth, 'line-dasharray': dashArray, }); @@ -657,16 +662,18 @@ const maxSpeed = 380 const startHue = 248 const endHue = 284; -const speedFillPaint = { - 'line-color': ['case', - ['boolean', ['feature-state', 'hover'], false], ['case', - ['all', ['>=', ['get', 'maxspeed'], 260], ['<=', ['get', 'maxspeed'], 300]], colors.hover.alternative, - colors.hover.main, - ], - ['==', ['get', 'maxspeed'], null], 'gray', - // Reverse hue order - ['concat', 'hsl(', ['%', ['+', ['-', startHue, ['*', startHue + (360 - endHue), ['/', ['-', ['max', minSpeed, ['min', ['get', 'maxspeed'], maxSpeed]], minSpeed], maxSpeed - minSpeed]]], 360], 360], ', 100%, 40%)'], +const speedColor = ['case', + ['boolean', ['feature-state', 'hover'], false], ['case', + ['all', ['>=', ['get', 'maxspeed'], 260], ['<=', ['get', 'maxspeed'], 300]], colors.hover.alternative, + colors.hover.main, ], + ['==', ['get', 'maxspeed'], null], 'gray', + // Reverse hue order + ['concat', 'hsl(', ['%', ['+', ['-', startHue, ['*', startHue + (360 - endHue), ['/', ['-', ['max', minSpeed, ['min', ['get', 'maxspeed'], maxSpeed]], minSpeed], maxSpeed - minSpeed]]], 360], 360], ', 100%, 40%)'], +] + +const speedFillPaint = { + 'line-color': speedColor, 'line-width': railwayLineWidth, }; @@ -701,54 +708,55 @@ const electrificationCasingPaint = { 'line-width': railwayLineWidth, 'line-gap-width': 0.75, }; -const electrificationFillPaint = (dashArray, voltageProperty, frequencyProperty) => ({ - 'line-color': ['case', - ['boolean', ['feature-state', 'hover'], false], ['case', - ['==', ['get', voltageProperty], 25000], colors.hover.alternative, - colors.hover.main, - ], - ['all', ['==', ['get', frequencyProperty], 60], ['==', ['get', voltageProperty], 25000]], color_25kv_60hz, - ['all', ['==', ['get', frequencyProperty], 50], ['==', ['get', voltageProperty], 25000]], color_25kv_50hz, - ['all', ['==', ['get', frequencyProperty], 60], ['==', ['get', voltageProperty], 20000]], color_20kv_60hz, - ['all', ['==', ['get', frequencyProperty], 50], ['==', ['get', voltageProperty], 20000]], color_20kv_50hz, - ['all', ['<', 16.665, ['get', frequencyProperty]], ['<', ['get', frequencyProperty], 16.675], ['==', ['get', voltageProperty], 15000]], color_15kv_16_67hz, - ['all', ['<', 16.65, ['get', frequencyProperty]], ['<', ['get', frequencyProperty], 16.75], ['==', ['get', voltageProperty], 15000]], color_15kv_16_7hz, - ['all', ['==', ['get', frequencyProperty], 60], ['==', ['get', voltageProperty], 12500]], color_12_5kv_60hz, - ['all', ['==', ['get', frequencyProperty], 25], ['==', ['get', voltageProperty], 12000]], color_12kv_25hz, - ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['>', ['get', voltageProperty], 3000]], color_gt3kv_dc, - ['all', ['==', ['get', frequencyProperty], 0], ['==', ['get', voltageProperty], 3000]], color_3kv_dc, - ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['>', 3000, ['get', voltageProperty]], ['>', ['get', voltageProperty], 1500]], color_gt1500v_lt3kv_dc, - ['all', ['==', ['get', frequencyProperty], 0], ['==', ['get', voltageProperty], 1500]], color_1500v_dc, - ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['>', 1500, ['get', voltageProperty]], ['>', ['get', voltageProperty], 1000]], color_gt1kv_lt1500v_dc, - ['all', ['==', ['get', frequencyProperty], 0], ['==', ['get', voltageProperty], 1000]], color_1kv_dc, - ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['>', 1000, ['get', voltageProperty]], ['>', ['get', voltageProperty], 750]], color_gt750v_lt1kv_dc, - ['all', ['==', ['get', frequencyProperty], 0], ['==', ['get', voltageProperty], 750]], color_750v_dc, - ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['<', 750, ['get', voltageProperty]]], color_lt750v_dc, - ['all', - ['!=', ['get', frequencyProperty], 0], - ['!=', ['get', voltageProperty], null], - ['any', - ['>', ['get', voltageProperty], 25000], - ['all', ['!=', ['get', frequencyProperty], 50], ['!=', ['get', frequencyProperty], 60], ['>', ['get', voltageProperty], 25000]], - ], - ], color_gte25kv_ac, - ['all', - ['!=', ['get', frequencyProperty], 0], - ['!=', ['get', voltageProperty], null], - ['all', ['>', 25000, ['get', voltageProperty]], ['>', ['get', voltageProperty], 15000]] - ], color_gte15kv_lt25kv_ac, - ['all', - ['!=', ['get', frequencyProperty], 0], - ['!=', ['get', voltageProperty], null], - ['>', 15000, ['get', voltageProperty]], - ], color_lt15kv_ac, - ['any', - ['==', ['get', 'electrification_state'], 'deelectrified'], - ['==', ['get', 'electrification_state'], 'abandoned'], - ], color_delectrified, - ['==', ['get', 'electrification_state'], 'no'], color_no, - 'gray', +const electrificationColor = (voltageProperty, frequencyProperty) => ['case', + ['boolean', ['feature-state', 'hover'], false], ['case', + ['==', ['get', voltageProperty], 25000], colors.hover.alternative, + colors.hover.main, ], + ['all', ['==', ['get', frequencyProperty], 60], ['==', ['get', voltageProperty], 25000]], color_25kv_60hz, + ['all', ['==', ['get', frequencyProperty], 50], ['==', ['get', voltageProperty], 25000]], color_25kv_50hz, + ['all', ['==', ['get', frequencyProperty], 60], ['==', ['get', voltageProperty], 20000]], color_20kv_60hz, + ['all', ['==', ['get', frequencyProperty], 50], ['==', ['get', voltageProperty], 20000]], color_20kv_50hz, + ['all', ['<', 16.665, ['get', frequencyProperty]], ['<', ['get', frequencyProperty], 16.675], ['==', ['get', voltageProperty], 15000]], color_15kv_16_67hz, + ['all', ['<', 16.65, ['get', frequencyProperty]], ['<', ['get', frequencyProperty], 16.75], ['==', ['get', voltageProperty], 15000]], color_15kv_16_7hz, + ['all', ['==', ['get', frequencyProperty], 60], ['==', ['get', voltageProperty], 12500]], color_12_5kv_60hz, + ['all', ['==', ['get', frequencyProperty], 25], ['==', ['get', voltageProperty], 12000]], color_12kv_25hz, + ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['>', ['get', voltageProperty], 3000]], color_gt3kv_dc, + ['all', ['==', ['get', frequencyProperty], 0], ['==', ['get', voltageProperty], 3000]], color_3kv_dc, + ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['>', 3000, ['get', voltageProperty]], ['>', ['get', voltageProperty], 1500]], color_gt1500v_lt3kv_dc, + ['all', ['==', ['get', frequencyProperty], 0], ['==', ['get', voltageProperty], 1500]], color_1500v_dc, + ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['>', 1500, ['get', voltageProperty]], ['>', ['get', voltageProperty], 1000]], color_gt1kv_lt1500v_dc, + ['all', ['==', ['get', frequencyProperty], 0], ['==', ['get', voltageProperty], 1000]], color_1kv_dc, + ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['>', 1000, ['get', voltageProperty]], ['>', ['get', voltageProperty], 750]], color_gt750v_lt1kv_dc, + ['all', ['==', ['get', frequencyProperty], 0], ['==', ['get', voltageProperty], 750]], color_750v_dc, + ['all', ['==', ['get', frequencyProperty], 0], ['!=', ['get', voltageProperty], null], ['<', 750, ['get', voltageProperty]]], color_lt750v_dc, + ['all', + ['!=', ['get', frequencyProperty], 0], + ['!=', ['get', voltageProperty], null], + ['any', + ['>', ['get', voltageProperty], 25000], + ['all', ['!=', ['get', frequencyProperty], 50], ['!=', ['get', frequencyProperty], 60], ['>', ['get', voltageProperty], 25000]], + ], + ], color_gte25kv_ac, + ['all', + ['!=', ['get', frequencyProperty], 0], + ['!=', ['get', voltageProperty], null], + ['all', ['>', 25000, ['get', voltageProperty]], ['>', ['get', voltageProperty], 15000]] + ], color_gte15kv_lt25kv_ac, + ['all', + ['!=', ['get', frequencyProperty], 0], + ['!=', ['get', voltageProperty], null], + ['>', 15000, ['get', voltageProperty]], + ], color_lt15kv_ac, + ['any', + ['==', ['get', 'electrification_state'], 'deelectrified'], + ['==', ['get', 'electrification_state'], 'abandoned'], + ], color_delectrified, + ['==', ['get', 'electrification_state'], 'no'], color_no, + 'gray', +]; +const electrificationFillPaint = (dashArray, voltageProperty, frequencyProperty) => ({ + 'line-color': electrificationColor(voltageProperty, frequencyProperty), 'line-width': railwayLineWidth, 'line-dasharray': dashArray, }); @@ -824,68 +832,55 @@ const gaugeCasingPaint = { 'line-gap-width': 0.75, }; -const gaugeFillPaint = (gaugeProperty, gaugeIntProperty, dashArray) => ({ - 'line-color': ['case', - ['boolean', ['feature-state', 'hover'], false], ['case', - ['all', ['!=', ['get', gaugeIntProperty], null], ['>=', 1450, ['get', gaugeIntProperty]], ['<=', ['get', gaugeIntProperty], 1524]], colors.hover.alternative, - colors.hover.main, - ], - // monorails or tracks with monorail gauge value - ['any', - ['==', ['get', 'railway'], 'monorail'], - ['all', - ['==', ['get', gaugeProperty], 'monorail'], - ['any', - ['==', ['get', 'feature'], 'rail'], - ['==', ['get', 'feature'], 'light_rail'], - ['==', ['get', 'feature'], 'subway'], - ['==', ['get', 'feature'], 'tram'], - ], - ], - ], color_gauge_monorail, - // other tracks with inaccurate gauge value +const gaugeColor = (gaugeProperty, gaugeIntProperty) => ['case', + ['boolean', ['feature-state', 'hover'], false], ['case', + ['all', ['!=', ['get', gaugeIntProperty], null], ['>=', 1450, ['get', gaugeIntProperty]], ['<=', ['get', gaugeIntProperty], 1524]], colors.hover.alternative, + colors.hover.main, + ], + // monorails or tracks with monorail gauge value + ['any', + ['==', ['get', 'railway'], 'monorail'], ['all', - ['==', ['get', gaugeProperty], 'standard'], + ['==', ['get', gaugeProperty], 'monorail'], ['any', ['==', ['get', 'feature'], 'rail'], ['==', ['get', 'feature'], 'light_rail'], ['==', ['get', 'feature'], 'subway'], ['==', ['get', 'feature'], 'tram'], ], - ], color_gauge_standard, + ], + ], color_gauge_monorail, + // other tracks with inaccurate gauge value + ['all', + ['==', ['get', gaugeProperty], 'standard'], + ['any', + ['==', ['get', 'feature'], 'rail'], + ['==', ['get', 'feature'], 'light_rail'], + ['==', ['get', 'feature'], 'subway'], + ['==', ['get', 'feature'], 'tram'], + ], + ], color_gauge_standard, + ['all', + ['==', ['get', gaugeProperty], 'broad'], + ['any', + ['==', ['get', 'feature'], 'rail'], + ['==', ['get', 'feature'], 'light_rail'], + ['==', ['get', 'feature'], 'subway'], + ['==', ['get', 'feature'], 'tram'], + ], + ], color_gauge_broad, + ['any', ['all', - ['==', ['get', gaugeProperty], 'broad'], + ['==', ['get', gaugeProperty], 'narrow'], ['any', ['==', ['get', 'feature'], 'rail'], ['==', ['get', 'feature'], 'light_rail'], ['==', ['get', 'feature'], 'subway'], ['==', ['get', 'feature'], 'tram'], ], - ], color_gauge_broad, - ['any', - ['all', - ['==', ['get', gaugeProperty], 'narrow'], - ['any', - ['==', ['get', 'feature'], 'rail'], - ['==', ['get', 'feature'], 'light_rail'], - ['==', ['get', 'feature'], 'subway'], - ['==', ['get', 'feature'], 'tram'], - ], - ], - ['all', - ['==', ['get', 'feature'], 'narrow_gauge'], - ['any', - ['==', ['get', gaugeProperty], 'narrow'], - ['==', ['get', gaugeProperty], 'broad'], - ['==', ['get', gaugeProperty], 'standard'], - ['==', ['get', gaugeProperty], 'unknown'], - ['==', ['get', gaugeProperty], null], - ], - ], - ], color_gauge_narrow, - // miniature tracks with inaccurate gauge value + ], ['all', - ['==', ['get', 'feature'], 'miniature'], + ['==', ['get', 'feature'], 'narrow_gauge'], ['any', ['==', ['get', gaugeProperty], 'narrow'], ['==', ['get', gaugeProperty], 'broad'], @@ -893,62 +888,76 @@ const gaugeFillPaint = (gaugeProperty, gaugeIntProperty, dashArray) => ({ ['==', ['get', gaugeProperty], 'unknown'], ['==', ['get', gaugeProperty], null], ], - ], color_gauge_miniature, - // unknown high numeric gauge values - ['all', ['!=', ['get', gaugeIntProperty], null], ['>=', ['get', gaugeIntProperty], 3000]], color_gauge_unknown, - // colors for numeric gauge values - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 88, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 63]], color_gauge_0064, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 127, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 88]], color_gauge_0089, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 184, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 127]], color_gauge_0127, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 190, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 184]], color_gauge_0184, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 260, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 190]], color_gauge_0190, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 380, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 260]], color_gauge_0260, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 500, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 380]], color_gauge_0381, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 597, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 500]], color_gauge_0500, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 600, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 597]], color_gauge_0597, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 609, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 600]], color_gauge_0600, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 700, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 609]], color_gauge_0610, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 750, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 700]], color_gauge_0700, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 760, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 750]], color_gauge_0750, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 762, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 760]], color_gauge_0760, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 785, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 762]], color_gauge_0762, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 800, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 785]], color_gauge_0785, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 891, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 800]], color_gauge_0800, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 900, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 891]], color_gauge_0891, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 914, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 900]], color_gauge_0900, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 950, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 914]], color_gauge_0914, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1000, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 950]], color_gauge_0950, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1009, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1000]], color_gauge_1000, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1050, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1009]], color_gauge_1009, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1066, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1050]], color_gauge_1050, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1100, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1066]], color_gauge_1067, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1200, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1100]], color_gauge_1100, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1372, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1200]], color_gauge_1200, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1422, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1372]], color_gauge_1372, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1432, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1422]], color_gauge_1422, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1435, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1432]], color_gauge_1432, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1440, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1435]], color_gauge_1435, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1445, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1440]], color_gauge_1440, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1450, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1445]], color_gauge_1445, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1458, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1450]], color_gauge_1450, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1495, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1458]], color_gauge_1458, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1520, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1495]], color_gauge_1495, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1522, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1520]], color_gauge_1520, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1524, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1522]], color_gauge_1522, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1581, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1524]], color_gauge_1524, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1588, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1581]], color_gauge_1581, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1600, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1588]], color_gauge_1588, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1668, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1600]], color_gauge_1600, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1672, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1668]], color_gauge_1668, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1700, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1672]], color_gauge_1676, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1800, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1700]], color_gauge_1700, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1880, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1800]], color_gauge_1800, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 2000, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1880]], color_gauge_1880, - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 3000, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 2000]], color_gauge_2000, - // color for unknown low numeric gauge values - ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 63, ['get', gaugeIntProperty]], ['>', ['get', gaugeIntProperty], 0]], color_gauge_unknown, - 'gray', - ], + ], + ], color_gauge_narrow, + // miniature tracks with inaccurate gauge value + ['all', + ['==', ['get', 'feature'], 'miniature'], + ['any', + ['==', ['get', gaugeProperty], 'narrow'], + ['==', ['get', gaugeProperty], 'broad'], + ['==', ['get', gaugeProperty], 'standard'], + ['==', ['get', gaugeProperty], 'unknown'], + ['==', ['get', gaugeProperty], null], + ], + ], color_gauge_miniature, + // unknown high numeric gauge values + ['all', ['!=', ['get', gaugeIntProperty], null], ['>=', ['get', gaugeIntProperty], 3000]], color_gauge_unknown, + // colors for numeric gauge values + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 88, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 63]], color_gauge_0064, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 127, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 88]], color_gauge_0089, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 184, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 127]], color_gauge_0127, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 190, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 184]], color_gauge_0184, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 260, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 190]], color_gauge_0190, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 380, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 260]], color_gauge_0260, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 500, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 380]], color_gauge_0381, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 597, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 500]], color_gauge_0500, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 600, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 597]], color_gauge_0597, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 609, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 600]], color_gauge_0600, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 700, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 609]], color_gauge_0610, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 750, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 700]], color_gauge_0700, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 760, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 750]], color_gauge_0750, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 762, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 760]], color_gauge_0760, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 785, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 762]], color_gauge_0762, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 800, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 785]], color_gauge_0785, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 891, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 800]], color_gauge_0800, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 900, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 891]], color_gauge_0891, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 914, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 900]], color_gauge_0900, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 950, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 914]], color_gauge_0914, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1000, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 950]], color_gauge_0950, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1009, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1000]], color_gauge_1000, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1050, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1009]], color_gauge_1009, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1066, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1050]], color_gauge_1050, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1100, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1066]], color_gauge_1067, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1200, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1100]], color_gauge_1100, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1372, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1200]], color_gauge_1200, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1422, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1372]], color_gauge_1372, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1432, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1422]], color_gauge_1422, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1435, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1432]], color_gauge_1432, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1440, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1435]], color_gauge_1435, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1445, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1440]], color_gauge_1440, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1450, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1445]], color_gauge_1445, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1458, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1450]], color_gauge_1450, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1495, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1458]], color_gauge_1458, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1520, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1495]], color_gauge_1495, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1522, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1520]], color_gauge_1520, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1524, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1522]], color_gauge_1522, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1581, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1524]], color_gauge_1524, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1588, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1581]], color_gauge_1581, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1600, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1588]], color_gauge_1588, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1668, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1600]], color_gauge_1600, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1672, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1668]], color_gauge_1668, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1700, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1672]], color_gauge_1676, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1800, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1700]], color_gauge_1700, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 1880, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1800]], color_gauge_1800, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 2000, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 1880]], color_gauge_1880, + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 3000, ['get', gaugeIntProperty]], ['>=', ['get', gaugeIntProperty], 2000]], color_gauge_2000, + // color for unknown low numeric gauge values + ['all', ['!=', ['get', gaugeIntProperty], null], ['>', 63, ['get', gaugeIntProperty]], ['>', ['get', gaugeIntProperty], 0]], color_gauge_unknown, + 'gray', +]; +const gaugeFillPaint = (gaugeProperty, gaugeIntProperty, dashArray) => ({ + 'line-color': gaugeColor(gaugeProperty, gaugeIntProperty), 'line-width': railwayLineWidth, 'line-dasharray': dashArray, }); @@ -1062,22 +1071,26 @@ const railwayKmText = { }, }; -const preferredDirectionLayer = (id, filter) => ({ +const preferredDirectionLayer = (id, filter, color) => ({ id, type: 'symbol', minzoom: 15, source: 'high', 'source-layer': 'railway_line_high', filter, + paint: { + 'icon-color': color, + 'icon-halo-color': 'white', + 'icon-halo-width': 2.0, + }, layout: { 'symbol-placement': 'line', 'symbol-spacing': 750, 'icon-overlap': 'always', - // TODO: replace with SDF image with line coloring 'icon-image': ['match', ['get', 'preferred_direction'], - 'forward', 'general/line-direction', - 'backward', 'general/line-direction', - 'both', 'general/line-direction-both', + 'forward', 'sdf:general/line-direction', + 'backward', 'sdf:general/line-direction', + 'both', 'sdf:general/line-direction-both', '', ], 'icon-rotate': ['match', ['get', 'preferred_direction'], @@ -1087,6 +1100,39 @@ const preferredDirectionLayer = (id, filter) => ({ }, }); +const imageLayerWithOutline = (id, spriteExpression, layer) => [ + { + id: `${id}_outline`, + ...layer, + paint: { + 'icon-halo-color': ['case', + ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, + 'white', + ], + 'icon-halo-blur': ['case', + ['boolean', ['feature-state', 'hover'], false], 1.0, + 0.0, + ], + 'icon-halo-width': ['case', + ['boolean', ['feature-state', 'hover'], false], 3.0, + 2.0, + ], + }, + layout: { + ...(layer.layout || {}), + 'icon-image': ['image', ['concat', 'sdf:', spriteExpression]], + }, + }, + { + id: `${id}_image`, + ...layer, + layout: { + ...(layer.layout || {}), + 'icon-image': ['image', spriteExpression], + }, + }, +] + // TODO remove all [switch, [zoom]] to ensure legend displays only visible features const layers = { standard: [ @@ -1350,14 +1396,18 @@ const layers = { 'line-color': 'rgba(255, 255, 255, 50%)', } }, - preferredDirectionLayer('railway_tunnel_preferred_direction', ['all', - ['get', 'tunnel'], - ['any', - ['==', ['get', 'preferred_direction'], 'forward'], - ['==', ['get', 'preferred_direction'], 'backward'], - ['==', ['get', 'preferred_direction'], 'both'], - ] - ]), + preferredDirectionLayer( + 'railway_tunnel_preferred_direction', + ['all', + ['get', 'tunnel'], + ['any', + ['==', ['get', 'preferred_direction'], 'forward'], + ['==', ['get', 'preferred_direction'], 'backward'], + ['==', ['get', 'preferred_direction'], 'both'], + ], + ], + standardColor, + ), { id: 'railway_construction_fill', type: 'line', @@ -1430,15 +1480,19 @@ const layers = { }, paint: standardFillPaint([1]), }, - preferredDirectionLayer('railway_preferred_direction', ['all', - ['!', ['get', 'bridge']], - ['!', ['get', 'tunnel']], - ['any', - ['==', ['get', 'preferred_direction'], 'forward'], - ['==', ['get', 'preferred_direction'], 'backward'], - ['==', ['get', 'preferred_direction'], 'both'], - ] - ]), + preferredDirectionLayer( + 'railway_preferred_direction', + ['all', + ['!', ['get', 'bridge']], + ['!', ['get', 'tunnel']], + ['any', + ['==', ['get', 'preferred_direction'], 'forward'], + ['==', ['get', 'preferred_direction'], 'backward'], + ['==', ['get', 'preferred_direction'], 'both'], + ] + ], + standardColor, + ), { id: 'railway_bridge_railing', type: 'line', @@ -1541,81 +1595,92 @@ const layers = { 'icon-image': 'general/tram-stop', } }, - { - id: 'railway_symbols_low', - type: 'symbol', - minzoom: 10, - source: 'openrailwaymap_standard', - 'source-layer': 'standard_railway_symbols', - filter: ['==', ['get', 'feature'], 'general/border'], - layout: { - 'icon-image': ['image', ['get', 'feature']], - } - }, - { - id: 'railway_symbols_med_high', - type: 'symbol', - minzoom: 13, - source: 'openrailwaymap_standard', - 'source-layer': 'standard_railway_symbols', - filter: ['any', - ['==', ['get', 'feature'], 'general/crossing'], - ['==', ['get', 'feature'], 'general/level-crossing'], - ['==', ['get', 'feature'], 'general/level-crossing-light'], - ['==', ['get', 'feature'], 'general/level-crossing-barrier'], - ['==', ['get', 'feature'], 'general/lubricator'], - ['==', ['get', 'feature'], 'general/fuel'], - ['==', ['get', 'feature'], 'general/sand_store'], - ['==', ['get', 'feature'], 'general/aei'], - ['==', ['get', 'feature'], 'general/buffer_stop'], - ['==', ['get', 'feature'], 'general/derail'], - ['==', ['get', 'feature'], 'general/defect_detector'], - ['==', ['get', 'feature'], 'general/hump_yard'], - ['==', ['get', 'feature'], 'general/loading_gauge'], - ['==', ['get', 'feature'], 'general/preheating'], - ['==', ['get', 'feature'], 'general/compressed_air_supply'], - ['==', ['get', 'feature'], 'general/waste_disposal'], - ['==', ['get', 'feature'], 'general/coaling_facility'], - ['==', ['get', 'feature'], 'general/wash'], - ['==', ['get', 'feature'], 'general/water_tower'], - ['==', ['get', 'feature'], 'general/water_crane'], - ['==', ['get', 'feature'], 'general/vacancy-detection-insulated-rail-joint'], - ['==', ['get', 'feature'], 'general/vacancy-detection-axle-counter'], - ], - layout: { - 'symbol-z-order': 'source', - 'icon-overlap': 'always', - 'icon-image': ['image', ['get', 'feature']], - } - }, - { - id: 'railway_symbols_med', - type: 'symbol', - minzoom: 12, - source: 'openrailwaymap_standard', - 'source-layer': 'standard_railway_symbols', - filter: ['any', - ['==', ['get', 'feature'], 'general/owner-change'], - ['==', ['get', 'feature'], 'general/radio-mast'], - ['==', ['get', 'feature'], 'general/radio-antenna'], - ], - layout: { - 'symbol-z-order': 'source', - 'icon-image': ['image', ['get', 'feature']], + ...imageLayerWithOutline( + 'railway_symbols_low', + ['get', 'feature'], + { + type: 'symbol', + minzoom: 10, + source: 'openrailwaymap_standard', + 'source-layer': 'standard_railway_symbols', + filter: ['==', ['get', 'feature'], 'general/border'], + layout: { + 'icon-overlap': 'cooperative', + }, }, - }, - { - id: 'railway_symbols_high', - type: 'symbol', - minzoom: 16, - source: 'openrailwaymap_standard', - 'source-layer': 'standard_railway_symbols', - filter: ['==', ['get', 'feature'], 'general/phone'], - layout: { - 'symbol-z-order': 'source', - 'icon-image': ['image', ['get', 'feature']], - } - }, + ), + ...imageLayerWithOutline( + 'railway_symbols_med_high', + ['get', 'feature'], + { + type: 'symbol', + minzoom: 13, + source: 'openrailwaymap_standard', + 'source-layer': 'standard_railway_symbols', + filter: ['any', + ['==', ['get', 'feature'], 'general/crossing'], + ['==', ['get', 'feature'], 'general/level-crossing'], + ['==', ['get', 'feature'], 'general/level-crossing-light'], + ['==', ['get', 'feature'], 'general/level-crossing-barrier'], + ['==', ['get', 'feature'], 'general/lubricator'], + ['==', ['get', 'feature'], 'general/fuel'], + ['==', ['get', 'feature'], 'general/sand_store'], + ['==', ['get', 'feature'], 'general/aei'], + ['==', ['get', 'feature'], 'general/buffer_stop'], + ['==', ['get', 'feature'], 'general/derail'], + ['==', ['get', 'feature'], 'general/defect_detector'], + ['==', ['get', 'feature'], 'general/hump_yard'], + ['==', ['get', 'feature'], 'general/loading_gauge'], + ['==', ['get', 'feature'], 'general/preheating'], + ['==', ['get', 'feature'], 'general/compressed_air_supply'], + ['==', ['get', 'feature'], 'general/waste_disposal'], + ['==', ['get', 'feature'], 'general/coaling_facility'], + ['==', ['get', 'feature'], 'general/wash'], + ['==', ['get', 'feature'], 'general/water_tower'], + ['==', ['get', 'feature'], 'general/water_crane'], + ['==', ['get', 'feature'], 'general/vacancy-detection-insulated-rail-joint'], + ['==', ['get', 'feature'], 'general/vacancy-detection-axle-counter'], + ], + layout: { + 'symbol-z-order': 'source', + 'icon-overlap': 'always', + }, + }, + ), + ...imageLayerWithOutline( + 'railway_symbols_med', + ['get', 'feature'], + { + type: 'symbol', + minzoom: 12, + source: 'openrailwaymap_standard', + 'source-layer': 'standard_railway_symbols', + filter: ['any', + ['==', ['get', 'feature'], 'general/owner-change'], + ['==', ['get', 'feature'], 'general/radio-mast'], + ['==', ['get', 'feature'], 'general/radio-antenna'], + ], + layout: { + 'symbol-z-order': 'source', + 'icon-overlap': 'always', + }, + }, + ), + ...imageLayerWithOutline( + 'railway_symbols_high', + ['get', 'feature'], + { + type: 'symbol', + minzoom: 16, + source: 'openrailwaymap_standard', + 'source-layer': 'standard_railway_symbols', + filter: ['==', ['get', 'feature'], 'general/phone'], + layout: { + 'symbol-z-order': 'source', + 'icon-overlap': 'always', + }, + }, + ), railwayKmText, { id: 'railway_text_track_numbers', @@ -2061,11 +2126,15 @@ const layers = { paint: speedFillPaint, layout: speedLayout, }, - preferredDirectionLayer('railway_preferred_direction', ['any', - ['==', ['get', 'preferred_direction'], 'forward'], - ['==', ['get', 'preferred_direction'], 'backward'], - ['==', ['get', 'preferred_direction'], 'both'], - ]), + preferredDirectionLayer( + 'railway_preferred_direction', + ['any', + ['==', ['get', 'preferred_direction'], 'forward'], + ['==', ['get', 'preferred_direction'], 'backward'], + ['==', ['get', 'preferred_direction'], 'both'], + ], + speedColor, + ), { id: 'speed_railway_signal_direction', type: 'symbol', @@ -2093,53 +2162,58 @@ const layers = { ['!=', ['get', 'azimuth'], null], ], ], + paint: { + 'icon-color': colors.signals.direction, + 'icon-halo-color': ['case', + ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, + 'white', + ], + 'icon-halo-width': 2.0, + 'icon-halo-blur': 2.0, + }, layout: { 'icon-overlap': 'always', 'icon-image': ['case', - ['get', 'direction_both'], 'general/signal-direction-both', - 'general/signal-direction', + ['get', 'direction_both'], 'sdf:general/signal-direction-both', + 'sdf:general/signal-direction', ], 'icon-anchor': ['case', ['get', 'direction_both'], 'center', 'top', ], 'icon-rotate': ['get', 'azimuth'], - } + }, }, - { - id: 'speed_railway_signals', - type: 'symbol', - source: 'openrailwaymap_speed', - minzoom: 13, - 'source-layer': 'speed_railway_signals', - filter: ['step', ['zoom'], - ['all', - ['!=', ['get', 'feature'], null], - ['==', ['get', 'type'], 'line'], - ], - 14, - ['all', - ['!=', ['get', 'feature'], null], - ['any', + ...imageLayerWithOutline( + 'speed_railway_signals', + ['get', 'feature'], + { + type: 'symbol', + source: 'openrailwaymap_speed', + minzoom: 13, + 'source-layer': 'speed_railway_signals', + filter: ['step', ['zoom'], + ['all', + ['!=', ['get', 'feature'], null], ['==', ['get', 'type'], 'line'], - ['==', ['get', 'type'], 'tram'], - ] + ], + 14, + ['all', + ['!=', ['get', 'feature'], null], + ['any', + ['==', ['get', 'type'], 'line'], + ['==', ['get', 'type'], 'tram'], + ] + ], + 16, + ['!=', ['get', 'feature'], null], ], - 16, - ['!=', ['get', 'feature'], null], - ], - paint: { - // TODO https://github.com/maplibre/martin/issues/1075 - // 'icon-halo-color': 'rgba(255, 255, 255, 1)', - // 'icon-halo-blur': 0, - // 'icon-halo-width': 2.0, + layout: { + 'symbol-z-order': 'source', + 'icon-overlap': 'always', + }, }, - layout: { - 'symbol-z-order': 'source', - 'icon-overlap': 'always', - 'icon-image': ['image', ['get', 'feature']], - } - }, + ), railwayKmText, { id: 'speed_railway_line_text', @@ -2264,11 +2338,15 @@ const layers = { paint: trainProtectionFillPaint([1]), layout: trainProtectionLayout, }, - preferredDirectionLayer('railway_preferred_direction', ['any', - ['==', ['get', 'preferred_direction'], 'forward'], - ['==', ['get', 'preferred_direction'], 'backward'], - ['==', ['get', 'preferred_direction'], 'both'], - ]), + preferredDirectionLayer( + 'railway_preferred_direction', + ['any', + ['==', ['get', 'preferred_direction'], 'forward'], + ['==', ['get', 'preferred_direction'], 'backward'], + ['==', ['get', 'preferred_direction'], 'both'], + ], + trainProtectionColor, + ), { id: 'signal_boxes_point', type: 'circle', @@ -2329,44 +2407,60 @@ const layers = { ['!=', ['get', 'azimuth'], null], ['!=', ['get', 'feature'], ''], ], + paint: { + 'icon-color': colors.signals.direction, + 'icon-halo-color': ['case', + ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, + 'white', + ], + 'icon-halo-width': 2.0, + 'icon-halo-blur': 2.0, + }, layout: { 'icon-overlap': 'always', 'icon-image': ['case', - ['get', 'direction_both'], 'general/signal-direction-both', - 'general/signal-direction', + ['get', 'direction_both'], 'sdf:general/signal-direction-both', + 'sdf:general/signal-direction', ], 'icon-anchor': ['case', ['get', 'direction_both'], 'center', 'top', ], 'icon-rotate': ['get', 'azimuth'], - } - }, - { - id: 'railway_signals', - type: 'symbol', - minzoom: 13, - source: 'openrailwaymap_signals', - 'source-layer': 'signals_railway_signals', - paint: { - // TODO https://github.com/maplibre/martin/issues/1075 - // 'icon-halo-color': 'rgba(255, 255, 255, 1)', - // 'icon-halo-blur': 0, - // 'icon-halo-width': 2.0, }, - layout: { - 'symbol-z-order': 'source', - 'icon-overlap': 'always', - 'icon-image': ['step', ['zoom'], - ['case', - ['==', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], 'de/blockkennzeichen', - ['image', ['get', 'feature']], - ], - 16, - ['image', ['get', 'feature']], - ], - } }, + ...imageLayerWithOutline( + 'railway_signals_medium', + ['case', + ['==', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], 'de/blockkennzeichen', + ['get', 'feature'], + ], + { + type: 'symbol', + minzoom: 13, + maxzoom: 16, + source: 'openrailwaymap_signals', + 'source-layer': 'signals_railway_signals', + layout: { + 'symbol-z-order': 'source', + 'icon-overlap': 'always', + }, + }, + ), + ...imageLayerWithOutline( + 'railway_signals_high', + ['get', 'feature'], + { + type: 'symbol', + minzoom: 16, + source: 'openrailwaymap_signals', + 'source-layer': 'signals_railway_signals', + layout: { + 'symbol-z-order': 'source', + 'icon-overlap': 'always', + }, + }, + ), { id: 'railway_signals_deactivated', type: 'symbol', @@ -2453,17 +2547,10 @@ const layers = { minzoom: 13, source: 'openrailwaymap_signals', 'source-layer': 'signals_railway_signals', - filter: ['step', ['zoom'], - ['all', - ['!=', ['get', 'ref'], null], - ['!=', ['get', 'feature'], ''], - ], - 16, - ['all', - ['!=', ['get', 'ref'], null], - ['!=', ['get', 'feature'], ''], - ['!=', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], - ], + filter: ['all', + ['!=', ['get', 'ref'], null], + ['!=', ['get', 'feature'], ''], + ['!=', ['slice', ['get', 'feature'], 0, 20], 'de/blockkennzeichen-'], ], paint: { 'text-halo-color': ['case', @@ -2574,11 +2661,15 @@ const layers = { paint: electrificationFillPaint(electrification_construction_dashes, 'future_voltage', 'future_frequency'), layout: electrificationLayout, }, - preferredDirectionLayer('railway_preferred_direction', ['any', - ['==', ['get', 'preferred_direction'], 'forward'], - ['==', ['get', 'preferred_direction'], 'backward'], - ['==', ['get', 'preferred_direction'], 'both'], - ]), + preferredDirectionLayer( + 'railway_preferred_direction', + ['any', + ['==', ['get', 'preferred_direction'], 'forward'], + ['==', ['get', 'preferred_direction'], 'backward'], + ['==', ['get', 'preferred_direction'], 'both'], + ], + electrificationColor('voltage', 'frequency'), + ), { id: 'electrification_signals_direction', type: 'symbol', @@ -2589,36 +2680,42 @@ const layers = { ['!=', ['get', 'azimuth'], null], ['!=', ['get', 'feature'], ''], ], + paint: { + 'icon-color': colors.signals.direction, + 'icon-halo-color': ['case', + ['boolean', ['feature-state', 'hover'], false], colors.hover.textHalo, + 'white', + ], + 'icon-halo-width': 2.0, + 'icon-halo-blur': 2.0, + }, layout: { 'icon-overlap': 'always', 'icon-image': ['case', - ['get', 'direction_both'], 'general/signal-direction-both', - 'general/signal-direction', + ['get', 'direction_both'], 'sdf:general/signal-direction-both', + 'sdf:general/signal-direction', ], 'icon-anchor': ['case', ['get', 'direction_both'], 'center', 'top', ], 'icon-rotate': ['get', 'azimuth'], - } - }, - { - id: 'electrification_signals', - type: 'symbol', - minzoom: 16, - source: 'openrailwaymap_electrification', - 'source-layer': 'electrification_signals', - paint: { - // TODO https://github.com/maplibre/martin/issues/1075 - // 'icon-halo-color': 'rgba(255, 255, 255, 1)', - // 'icon-halo-blur': 0, - // 'icon-halo-width': 2.0, }, - layout: { - 'icon-overlap': 'always', - 'icon-image': ['image', ['get', 'feature']], - } }, + ...imageLayerWithOutline( + 'electrification_signals', + ['get', 'feature'], + { + type: 'symbol', + minzoom: 16, + source: 'openrailwaymap_electrification', + 'source-layer': 'electrification_signals', + layout: { + 'symbol-z-order': 'source', + 'icon-overlap': 'always', + }, + }, + ), railwayKmText, { id: 'electrification_railway_text_high', @@ -2899,11 +2996,15 @@ const layers = { paint: gaugeFillPaint('gauge2', 'gaugeint2', multi_construction_dashes), layout: gaugeLayout, }, - preferredDirectionLayer('railway_preferred_direction', ['any', - ['==', ['get', 'preferred_direction'], 'forward'], - ['==', ['get', 'preferred_direction'], 'backward'], - ['==', ['get', 'preferred_direction'], 'both'], - ]), + preferredDirectionLayer( + 'railway_preferred_direction', + ['any', + ['==', ['get', 'preferred_direction'], 'forward'], + ['==', ['get', 'preferred_direction'], 'backward'], + ['==', ['get', 'preferred_direction'], 'both'], + ], + gaugeColor('gauge0', 'gaugeint0'), + ), railwayKmText, { id: 'gauge_railway_text_high', @@ -3057,7 +3158,16 @@ const makeStyle = selectedStyle => ({ metadata: {}, name: `OpenRailwayMap ${selectedStyle}`, sources, - sprite: `${origin}/sprite/symbols`, + sprite: [ + { + id: 'sdf', + url: `${origin}/sdf_sprite/symbols` + }, + { + id: 'default', + url: `${origin}/sprite/symbols` + } + ], version: 8, layers: layers[selectedStyle], }); diff --git a/symbols/general/aei.svg b/symbols/general/aei.svg index c2aaf614..47ca2f0a 100644 --- a/symbols/general/aei.svg +++ b/symbols/general/aei.svg @@ -1,4 +1,4 @@ - - + + diff --git a/symbols/general/buffer_stop.svg b/symbols/general/buffer_stop.svg index 1e0ce0bb..c619b286 100644 --- a/symbols/general/buffer_stop.svg +++ b/symbols/general/buffer_stop.svg @@ -1,7 +1,7 @@ - - - - - + + + + + diff --git a/symbols/general/coaling_facility.svg b/symbols/general/coaling_facility.svg index 35b7f93a..ccad46a0 100644 --- a/symbols/general/coaling_facility.svg +++ b/symbols/general/coaling_facility.svg @@ -1,4 +1,4 @@ - - + + diff --git a/symbols/general/crossing.svg b/symbols/general/crossing.svg index 75d030f0..068016e3 100644 --- a/symbols/general/crossing.svg +++ b/symbols/general/crossing.svg @@ -1,134 +1,17 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/symbols/general/derail.svg b/symbols/general/derail.svg index b3372374..45c46df7 100644 --- a/symbols/general/derail.svg +++ b/symbols/general/derail.svg @@ -1,6 +1,6 @@ - - - - + + + + diff --git a/symbols/general/etcs-stop-marker-arrow-left.svg b/symbols/general/etcs-stop-marker-arrow-left.svg index 79ea5592..64ed83f9 100644 --- a/symbols/general/etcs-stop-marker-arrow-left.svg +++ b/symbols/general/etcs-stop-marker-arrow-left.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/symbols/general/etcs-stop-marker-triangle-left.svg b/symbols/general/etcs-stop-marker-triangle-left.svg index f68b47c7..4f906654 100644 --- a/symbols/general/etcs-stop-marker-triangle-left.svg +++ b/symbols/general/etcs-stop-marker-triangle-left.svg @@ -1,6 +1,6 @@ - - - + + + diff --git a/symbols/general/level-crossing-barrier.svg b/symbols/general/level-crossing-barrier.svg index b60ed10e..b302a04a 100644 --- a/symbols/general/level-crossing-barrier.svg +++ b/symbols/general/level-crossing-barrier.svg @@ -1,230 +1,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/symbols/general/level-crossing-light.svg b/symbols/general/level-crossing-light.svg index ac4f4608..7d3405b7 100644 --- a/symbols/general/level-crossing-light.svg +++ b/symbols/general/level-crossing-light.svg @@ -1,178 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + diff --git a/symbols/general/level-crossing.svg b/symbols/general/level-crossing.svg index 7728edde..39ba4d0a 100644 --- a/symbols/general/level-crossing.svg +++ b/symbols/general/level-crossing.svg @@ -1,135 +1,17 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + diff --git a/symbols/general/line-direction-both.svg b/symbols/general/line-direction-both.svg index 4f8cbae6..55eaafdd 100644 --- a/symbols/general/line-direction-both.svg +++ b/symbols/general/line-direction-both.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/symbols/general/line-direction.svg b/symbols/general/line-direction.svg index 1064cc7d..c1deab7a 100644 --- a/symbols/general/line-direction.svg +++ b/symbols/general/line-direction.svg @@ -1,4 +1,4 @@ - - + + diff --git a/symbols/general/loading_gauge.svg b/symbols/general/loading_gauge.svg index b2f9fe5f..36e3fd85 100644 --- a/symbols/general/loading_gauge.svg +++ b/symbols/general/loading_gauge.svg @@ -1,4 +1,4 @@ - - + + diff --git a/symbols/general/phone.svg b/symbols/general/phone.svg index 53b8ebba..65c70f01 100644 --- a/symbols/general/phone.svg +++ b/symbols/general/phone.svg @@ -1,5 +1,4 @@ - - - + + diff --git a/symbols/general/preheating.svg b/symbols/general/preheating.svg index c6164871..7a336638 100644 --- a/symbols/general/preheating.svg +++ b/symbols/general/preheating.svg @@ -1,4 +1,4 @@ - - + + diff --git a/symbols/general/radio-antenna.svg b/symbols/general/radio-antenna.svg index 8ba276f3..a2b35720 100644 --- a/symbols/general/radio-antenna.svg +++ b/symbols/general/radio-antenna.svg @@ -1,8 +1,7 @@ - - - - - - + + + + + diff --git a/symbols/general/radio-mast.svg b/symbols/general/radio-mast.svg index 0b0e2ffc..dc1c4941 100644 --- a/symbols/general/radio-mast.svg +++ b/symbols/general/radio-mast.svg @@ -1,9 +1,8 @@ - - - - - - - + + + + + + diff --git a/symbols/general/sand_store.svg b/symbols/general/sand_store.svg index 41c33a8a..b5a18439 100644 --- a/symbols/general/sand_store.svg +++ b/symbols/general/sand_store.svg @@ -1,4 +1,4 @@ - - + + diff --git a/symbols/general/signal-direction-both.svg b/symbols/general/signal-direction-both.svg index e8721b8a..6d06567b 100644 --- a/symbols/general/signal-direction-both.svg +++ b/symbols/general/signal-direction-both.svg @@ -1,5 +1,5 @@ - - - + + + diff --git a/symbols/general/signal-direction.svg b/symbols/general/signal-direction.svg index fb15efa3..82e6b275 100644 --- a/symbols/general/signal-direction.svg +++ b/symbols/general/signal-direction.svg @@ -1,4 +1,4 @@ - + diff --git a/symbols/general/tram-stop.svg b/symbols/general/tram-stop.svg index 5d931a1d..4222200b 100644 --- a/symbols/general/tram-stop.svg +++ b/symbols/general/tram-stop.svg @@ -1,4 +1,4 @@ - - + + diff --git a/symbols/general/vacancy-detection-axle-counter.svg b/symbols/general/vacancy-detection-axle-counter.svg index d0d3390e..1f161449 100644 --- a/symbols/general/vacancy-detection-axle-counter.svg +++ b/symbols/general/vacancy-detection-axle-counter.svg @@ -1,15 +1,8 @@ - - - - - - - - - - - - - + + + + + + diff --git a/symbols/general/vacancy-detection-insulated-rail-joint.svg b/symbols/general/vacancy-detection-insulated-rail-joint.svg index 202eadf2..94bb1841 100644 --- a/symbols/general/vacancy-detection-insulated-rail-joint.svg +++ b/symbols/general/vacancy-detection-insulated-rail-joint.svg @@ -1,9 +1,6 @@ - - - - - - - + + + + diff --git a/symbols/general/waste_disposal.svg b/symbols/general/waste_disposal.svg index 4bf14caa..c364c00d 100644 --- a/symbols/general/waste_disposal.svg +++ b/symbols/general/waste_disposal.svg @@ -1,4 +1,4 @@ - - + + diff --git a/symbols/general/water_tower.svg b/symbols/general/water_tower.svg index fe496b13..b223ae71 100644 --- a/symbols/general/water_tower.svg +++ b/symbols/general/water_tower.svg @@ -1,4 +1,4 @@ - - + +