Skip to content

Commit

Permalink
Render railway positions for low zooms without decimal (#139)
Browse files Browse the repository at this point in the history
This solves some of the clutter on the map, now that railway positions
are shown in every layer.


![image](https://github.com/user-attachments/assets/aff963d2-d993-4a28-9d01-42d3821362b1)
  • Loading branch information
hiddewie authored Nov 3, 2024
1 parent 20a0530 commit 0875324
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion import/sql/tile_views.sql
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ CREATE OR REPLACE VIEW railway_text_km AS
way,
railway,
pos,
(railway_pos_decimal(pos) = '0') as zero
(railway_pos_decimal(pos) = '0') as zero,
left(pos, -2) as pos_int
FROM
(SELECT
id,
Expand Down
1 change: 1 addition & 0 deletions martin/configuration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ postgres:
id: integer
railway: string
pos: string
pos_int: string
zero: boolean

standard_railway_switch_ref:
Expand Down
6 changes: 5 additions & 1 deletion proxy/js/styles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,11 @@ const railwayKmText = {
},
layout: {
'symbol-z-order': 'source',
'text-field': '{pos}',
'text-field': ['step', ['zoom'],
['get', 'pos_int'],
13,
['get', 'pos'],
],
'text-font': ['Noto Sans Bold'],
'text-size': 11,
},
Expand Down

0 comments on commit 0875324

Please sign in to comment.