render commuter train refs

Sat, 26 Sep 2020 00:55:46 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 26 Sep 2020 00:55:46 +0300
changeset 4
34a84c0a427c
parent 3
89b6a7562889
child 5
63cfc4b10f9c

render commuter train refs

empty.png file | annotate | diff | comparison | revisions
flex.lua file | annotate | diff | comparison | revisions
project.mml file | annotate | diff | comparison | revisions
style/roads.mss file | annotate | diff | comparison | revisions
Binary file empty.png has changed
--- a/flex.lua	Sat Sep 26 00:54:51 2020 +0300
+++ b/flex.lua	Sat Sep 26 00:55:46 2020 +0300
@@ -949,7 +949,7 @@
 
 
 function osm2pgsql.select_relation_members(relation)
-	if relation.tags.type == 'route' and (relation.tags.route == 'foot' or relation.tags.route == 'hiking' or relation.tags.route == 'bicycle')
+	if relation.tags.type == 'route' and (relation.tags.route == 'foot' or relation.tags.route == 'hiking' or relation.tags.route == 'bicycle' or relation.tags.route == 'train' or relation.tags.route == 'bus')
 	then
 		for _, member in ipairs(relation.members) do
 			if member.type == 'w' then
--- a/project.mml	Sat Sep 26 00:54:51 2020 +0300
+++ b/project.mml	Sat Sep 26 00:55:46 2020 +0300
@@ -873,3 +873,18 @@
 				) AS railway_platform_edge_ref
 		properties:
 			minzoom: 17
+	- id: commuter-train-ref
+		geometry: linestring
+		<<: *extents
+		Datasource:
+			<<: *osm2pgsql
+			table: |-
+				(SELECT
+					way,
+					ref
+					FROM planet_osm_routes
+					WHERE "route" = 'train' AND length(ref) = 1 AND network = 'HSL'
+					ORDER BY ref
+				) AS commuter_trains
+		properties:
+			minzoom: 15
--- a/style/roads.mss	Sat Sep 26 00:54:51 2020 +0300
+++ b/style/roads.mss	Sat Sep 26 00:55:46 2020 +0300
@@ -678,3 +678,18 @@
 	[zoom >= 16] { text-size: 11; }
 	[zoom >= 17] { text-size: 12; }
 }
+
+#commuter-train-ref
+{
+	shield-name: "[ref]";
+	shield-size: 12;
+	shield-fill: white;
+	shield-spacing: 600;
+	shield-repeat-distance: 200;
+	shield-placement: line;
+	shield-face-name: @railway-fonts-bold;
+	shield-halo-radius: @standard-halo-radius * 1.5;
+	shield-halo-fill: purple;
+	shield-allow-overlap: false;
+	shield-file: url('empty.png');
+}

mercurial