render bus routes

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

author
Teemu Piippo <teemu@hecknology.net>
date
Sat, 26 Sep 2020 00:55:58 +0300
changeset 5
63cfc4b10f9c
parent 4
34a84c0a427c
child 6
0575190fa5fc

render bus routes

project.mml file | annotate | diff | comparison | revisions
style/roads.mss file | annotate | diff | comparison | revisions
--- a/project.mml	Sat Sep 26 00:55:46 2020 +0300
+++ b/project.mml	Sat Sep 26 00:55:58 2020 +0300
@@ -300,6 +300,20 @@
 			table: *road_sql
 		properties:
 			minzoom: 10
+	- id: bus-route-layer-n1
+		geometry: linestring
+		<<: *extents
+		Datasource:
+			<<: *osm2pgsql
+			table: &bus_routes_sql |-
+				(SELECT DISTINCT
+					way,
+					COALESCE(layer::integer, 0) AS layer
+					FROM planet_osm_routes
+					WHERE "route" = 'bus'
+				) AS bus_routes
+		properties:
+			minzoom: 15
 	- id: rail-layer-n1
 		geometry: linestring
 		Datasource:
@@ -343,6 +357,14 @@
 			table: *road_sql
 		properties:
 			minzoom: 12
+	- id: bus-route
+		geometry: linestring
+		<<: *extents
+		Datasource:
+			<<: *osm2pgsql
+			table: *bus_routes_sql
+		properties:
+			minzoom: 15
 	- id: rail
 		geometry: linestring
 		Datasource:
@@ -385,6 +407,14 @@
 			table: *road_sql
 		properties:
 			minzoom: 12
+	- id: bus-route-layer-1
+		geometry: linestring
+		<<: *extents
+		Datasource:
+			<<: *osm2pgsql
+			table: *bus_routes_sql
+		properties:
+			minzoom: 15
 	- id: rail-layer-1
 		geometry: linestring
 		Datasource:
@@ -888,3 +918,18 @@
 				) AS commuter_trains
 		properties:
 			minzoom: 15
+	- id: bus-ref
+		geometry: linestring
+		<<: *extents
+		Datasource:
+			<<: *osm2pgsql
+			table: |-
+				(SELECT
+					way,
+					ref
+					FROM planet_osm_routes
+					WHERE "route" = 'bus' AND ref IS NOT NULL
+					ORDER BY ref
+				) AS commuter_trains
+		properties:
+			minzoom: 17
--- a/style/roads.mss	Sat Sep 26 00:55:46 2020 +0300
+++ b/style/roads.mss	Sat Sep 26 00:55:58 2020 +0300
@@ -693,3 +693,32 @@
 	shield-allow-overlap: false;
 	shield-file: url('empty.png');
 }
+
+#bus-route-layer-n1[layer < 0],
+#bus-route[layer = 0],
+#bus-route-layer-1[layer > 0]
+{
+	line-width: 1.5;
+	[zoom >= 17] { line-width: 2; }
+	[zoom >= 18] { line-width: 2.5; }
+	[zoom >= 19] { line-width: 3; }
+	line-color: gold;
+	line-dasharray: 24, 12;
+}
+
+#bus-ref
+{
+	text-name: "[ref]";
+	text-size: 10;
+	[zoom >= 17] { text-size: 11; }
+	[zoom >= 18] { text-size: 12; }
+	text-fill: black;
+	text-spacing: 600;
+	text-repeat-distance: 200;
+	text-placement: line;
+	text-face-name: "Liikenne Regular";
+	text-halo-radius: @standard-halo-radius;
+	text-halo-fill: white;
+	text-allow-overlap: false;
+	text-margin: 30;
+}

mercurial