Skip to content

Commit

Permalink
Use SDF sprites to render icon halos (#128)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
hiddewie authored Oct 26, 2024
1 parent a02f683 commit 90fa120
Show file tree
Hide file tree
Showing 31 changed files with 678 additions and 1,170 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 12 additions & 3 deletions features/signals_railway_signals.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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' }

Expand Down
9 changes: 0 additions & 9 deletions import/openrailwaymap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down Expand Up @@ -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(),
Expand All @@ -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 %}'],
Expand Down
4 changes: 2 additions & 2 deletions martin-static.Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
CMD ["/tiles", "--listen-addresses", "[::]:3000", "--sprite", "/symbols", "--font", "/config/fonts"]
4 changes: 2 additions & 2 deletions martin.Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
CMD ["--config", "/config/configuration.yml", "--sprite", "/symbols", "--font", "/config/fonts"]
918 changes: 514 additions & 404 deletions proxy/js/styles.mjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions symbols/general/aei.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions symbols/general/buffer_stop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions symbols/general/coaling_facility.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 90fa120

Please sign in to comment.