Skip to content

Commit 90fa120

Browse files
authored
Use SDF sprites to render icon halos (#128)
Uses maplibre/martin#1492 Unfortunately, SDF sprites cannot be layered right below each image, they have to be in their own layer below the icons. Symbols with outline: ![image](https://github.com/user-attachments/assets/da290ed7-441a-4c88-881a-88ee845d3acf) Hovering on rail lines in their native color: ![image](https://github.com/user-attachments/assets/79556b75-e6ab-4c37-95d6-87c9d22264ab) Railway direction including hover: ![image](https://github.com/user-attachments/assets/fe071904-2e9d-450f-8f63-e0613c8ac515)
1 parent a02f683 commit 90fa120

31 files changed

+678
-1170
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ services:
4444
- OSM2PGSQL_DATAFILE
4545

4646
martin-cp:
47-
image: ghcr.io/maplibre/martin
47+
image: ghcr.io/maplibre/martin:main
4848
depends_on:
4949
db:
5050
condition: service_healthy

features/signals_railway_signals.yaml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,9 +826,18 @@ signals_railway_signals:
826826

827827
- description: Blockkennzeichen
828828
country: DE
829-
# TODO match width and height
830-
# WHEN ref_width <= 4 AND ref_height <= 2 THEN CONCAT('de/blockkennzeichen-', ref_width, 'x', ref_height)
831-
icon: { default: 'de/blockkennzeichen' }
829+
icon:
830+
match: 'ref_multiline'
831+
cases:
832+
- { regex: '^([^\n]{4}\n[^\n]{1,4})|([^\n]{1,4}\n[^\n]{4})$', value: 'de/blockkennzeichen-4x2' }
833+
- { regex: '^[^\n]{4}$', value: 'de/blockkennzeichen-4x1' }
834+
- { regex: '^([^\n]{3}\n[^\n]{1,3})|([^\n]{1,3}\n[^\n]{3})$', value: 'de/blockkennzeichen-3x2' }
835+
- { regex: '^[^\n]{3}$', value: 'de/blockkennzeichen-3x1' }
836+
- { regex: '^([^\n]{2}\n[^\n]{1,2})|([^\n]{1,2}\n[^\n]{2})$', value: 'de/blockkennzeichen-2x2' }
837+
- { regex: '^[^\n]{2}$', value: 'de/blockkennzeichen-2x1' }
838+
- { regex: '^[^\n]\n[^\n]$', value: 'de/blockkennzeichen-1x2' }
839+
- { regex: '^[^\n]$', value: 'de/blockkennzeichen-1x1' }
840+
default: 'de/blockkennzeichen'
832841
tags:
833842
- { tag: 'railway:signal:train_protection', value: 'DE-ESO:blockkennzeichen' }
834843

import/openrailwaymap.lua

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,6 @@ local signals = osm2pgsql.define_table({
169169
{ column = 'deactivated', type = 'boolean' },
170170
{ column = 'ref', type = 'text' },
171171
{ column = 'ref_multiline', type = 'text' },
172-
{ column = 'ref_width', type = 'smallint' },
173-
{ column = 'ref_height', type = 'smallint' },
174172
{ column = 'signal_direction', type = 'text' },
175173
{% for tag in signals_railway_signals.tags %}
176174
{ column = '{% tag %}', type = 'text' },
@@ -429,11 +427,6 @@ function osm2pgsql.process_node(object)
429427
tags['railway:signal:speed_limit:deactivated']
430428
) == 'yes'
431429
local ref_multiline, newline_count = (tags.ref or ''):gsub(' ', '\n')
432-
local ref_height = newline_count + 1
433-
local ref_width = 0
434-
for part in string.gmatch(tags.ref or '', '[^ ]+') do
435-
ref_width = math.max(ref_width, part:len())
436-
end
437430

438431
signals:insert({
439432
way = object:as_point(),
@@ -442,8 +435,6 @@ function osm2pgsql.process_node(object)
442435
deactivated = deactivated,
443436
ref = tags.ref,
444437
ref_multiline = ref_multiline ~= '' and ref_multiline or nil,
445-
ref_height = ref_multiline ~= '' and ref_height or nil,
446-
ref_width = ref_multiline ~= '' and ref_width or nil,
447438
signal_direction = tags['railway:signal:direction'],
448439
{% for tag in signals_railway_signals.tags %}
449440
["{% tag %}"] = tags['{% tag %}'],

martin-static.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
FROM ghcr.io/maplibre/martin
1+
FROM ghcr.io/maplibre/martin:main
22

33
COPY martin /config
44
COPY symbols /symbols
55
COPY tiles /tiles
66

7-
CMD ["/tiles", "--listen-addresses", "[::]:3000", "--sprite", "/symbols", "--font", "/config/fonts"]
7+
CMD ["/tiles", "--listen-addresses", "[::]:3000", "--sprite", "/symbols", "--font", "/config/fonts"]

martin.Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
FROM ghcr.io/maplibre/martin
1+
FROM ghcr.io/maplibre/martin:main
22

33
COPY martin /config
44
COPY symbols /symbols
55

6-
CMD ["--config", "/config/configuration.yml", "--sprite", "/symbols", "--font", "/config/fonts"]
6+
CMD ["--config", "/config/configuration.yml", "--sprite", "/symbols", "--font", "/config/fonts"]

proxy/js/styles.mjs

Lines changed: 514 additions & 404 deletions
Large diffs are not rendered by default.

symbols/general/aei.svg

Lines changed: 2 additions & 2 deletions
Loading

symbols/general/buffer_stop.svg

Lines changed: 5 additions & 5 deletions
Loading
Lines changed: 2 additions & 2 deletions
Loading

0 commit comments

Comments
 (0)