Skip to content

Commit dc3589c

Browse files
committed
Localized station names
For #409 Work in progress
1 parent fb84a68 commit dc3589c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

import/sql/tile_views.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ CREATE OR REPLACE VIEW railway_text_stations AS
361361
ELSE 'small'
362362
END AS station_size,
363363
name,
364+
name_tags,
364365
CASE
365366
WHEN state != 'present' THEN 100
366367
WHEN feature = 'station' AND station = 'light_rail' THEN 450
@@ -667,7 +668,7 @@ DO $do$ BEGIN
667668
$$::json || '$tj$';
668669
END $do$;
669670

670-
CREATE OR REPLACE FUNCTION standard_railway_text_stations(z integer, x integer, y integer)
671+
CREATE OR REPLACE FUNCTION standard_railway_text_stations(z integer, x integer, y integer, query json)
671672
RETURNS bytea
672673
LANGUAGE SQL
673674
IMMUTABLE
@@ -688,6 +689,7 @@ RETURN (
688689
station_size,
689690
railway_ref as label,
690691
name,
692+
name_tags['name:' || (query->>'lang')::text] as localized_name,
691693
count,
692694
uic_ref,
693695
operator,
@@ -727,6 +729,7 @@ DO $do$ BEGIN
727729
"station_size": "string",
728730
"label": "string",
729731
"name": "string",
732+
"localized_name": "string",
730733
"operator": "string",
731734
"operator_hash": "string",
732735
"network": "string",

proxy/js/styles.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2425,7 +2425,7 @@ const layers = {
24252425
'text-field': ['step', ['zoom'],
24262426
['get', ['global-state', 'stationLowZoomLabel']],
24272427
10,
2428-
['get', 'name'],
2428+
['get', 'localized_name'],
24292429
],
24302430
'text-font': ['case',
24312431
['in', ['get', 'state'], ['literal', ['construction', 'proposed']]], ['literal', font.italic],
@@ -2470,11 +2470,11 @@ const layers = {
24702470
layout: {
24712471
'symbol-z-order': 'source',
24722472
'text-field': ['step', ['zoom'],
2473-
['get', 'name'],
2473+
['get', 'localized_name'],
24742474
15,
24752475
['case',
2476-
['>', ['coalesce', ['get', 'count'], 0], 1], ['concat', ['get', 'name'], ' (', ['get', 'count'], ')'],
2477-
['get', 'name'],
2476+
['>', ['coalesce', ['get', 'count'], 0], 1], ['concat', ['get', 'localized_name'], ' (', ['get', 'count'], ')'],
2477+
['get', 'localized_name'],
24782478
],
24792479
],
24802480
'text-font': ['case',

0 commit comments

Comments
 (0)