From 6253be018a002118be58093bc110ac20c9565a16 Mon Sep 17 00:00:00 2001 From: "Phyks (Lucas Verney)" Date: Sat, 8 Aug 2020 16:29:08 +0200 Subject: [PATCH] First render of CLPC --- amenities.mss | 13 ++++++++ project.mml | 39 ++++++++++++++++++++++ symbols/clpc/right.svg | 11 +++++++ symbols/clpc/straight.svg | 69 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 symbols/clpc/right.svg create mode 100644 symbols/clpc/straight.svg diff --git a/amenities.mss b/amenities.mss index 81712165..dda01dda 100644 --- a/amenities.mss +++ b/amenities.mss @@ -1231,3 +1231,16 @@ } } } + +#clpc[zoom >= 19] { + marker-width: 30; + marker-file: url('symbols/clpc/right.svg'); + [angle <= 45], + [angle >= 135][angle <= 225] { + marker-file: url('symbols/clpc/straight.svg'); + marker-transform: 'translate(15, 15) rotate([angle])'; + } + [angle > 45][angle < 135] { + marker-transform: 'translate(-15, 0) rotate([angle])'; + } +} diff --git a/project.mml b/project.mml index aa0a2417..a27f8759 100644 --- a/project.mml +++ b/project.mml @@ -1935,6 +1935,45 @@ Layer: geometry: point properties: minzoom: 10 +- id: clpc + <<: *extents + Datasource: + <<: *osm2pgsql + table: |- + ( + SELECT + ST_Centroid( + ST_Intersection( + ST_Union(h1.way, h2.way), + ST_Difference( + ST_Buffer(ST_Intersection(h1.way, h2.way), 30), + ST_Buffer(ST_Intersection(h1.way, h2.way), 20) + ) + ) + ) AS way, + CASE + WHEN members[array_position(members, CONCAT('w', h1.osm_id)) + 1] = 'from' THEN + cast(degrees(ST_Angle(h1.way, h2.way)) AS integer) + ELSE + cast(degrees(ST_Angle(h2.way, h1.way)) AS integer) + END AS angle + FROM + planet_osm_line h1 + JOIN planet_osm_line h2 ON ST_Intersects(h1.way, h2.way) + JOIN planet_osm_rels r ON ( + parts @> array[h1.osm_id, h2.osm_id] + AND r.tags @> array['type','restriction','restriction:bicycle','give_way'] + ) + WHERE + h1.way && !bbox! + AND h2.way && !bbox! + AND h1.highway IS NOT NULL + AND h2.highway IS NOT NULL + AND h1.osm_id > h2.osm_id + ) AS data + geometry: point + properties: + minzoom: 19 - id: waterway_label <<: *extents Datasource: diff --git a/symbols/clpc/right.svg b/symbols/clpc/right.svg new file mode 100644 index 00000000..11892309 --- /dev/null +++ b/symbols/clpc/right.svg @@ -0,0 +1,11 @@ + + +image/svg+xml + + + + + + + + \ No newline at end of file diff --git a/symbols/clpc/straight.svg b/symbols/clpc/straight.svg new file mode 100644 index 00000000..27b7bd5c --- /dev/null +++ b/symbols/clpc/straight.svg @@ -0,0 +1,69 @@ + +image/svg+xml + + + + + + + +