From 0feb28278844b4b80d91a070af3d8da2244b3142 Mon Sep 17 00:00:00 2001 From: Dustin Carlino Date: Wed, 16 Aug 2023 17:55:52 +0100 Subject: [PATCH] Add a layer for existing cycle paths. #299 --- src/lib/browse/LayerControls.svelte | 2 + src/lib/browse/colors.ts | 8 + .../layers/CyclePathsLayerControl.svelte | 148 ++++++++++++++++++ src/maplibre_helpers.ts | 6 +- 4 files changed, 162 insertions(+), 2 deletions(-) create mode 100644 src/lib/browse/layers/CyclePathsLayerControl.svelte diff --git a/src/lib/browse/LayerControls.svelte b/src/lib/browse/LayerControls.svelte index d26ee7005..57fadefac 100644 --- a/src/lib/browse/LayerControls.svelte +++ b/src/lib/browse/LayerControls.svelte @@ -5,6 +5,7 @@ import CensusOutputAreaLayerControl from "./layers/CensusOutputAreaLayerControl.svelte"; import CombinedAuthoritiesLayerControl from "./layers/CombinedAuthoritiesLayerControl.svelte"; import CycleParkingLayerControl from "./layers/CycleParkingLayerControl.svelte"; + import CyclePathsLayerControl from "./layers/CyclePathsLayerControl.svelte"; import HospitalsLayerControl from "./layers/HospitalsLayerControl.svelte"; import ImdLayerControl from "./layers/ImdLayerControl.svelte"; import LocalAuthorityDistrictsLayerControl from "./layers/LocalAuthorityDistrictsLayerControl.svelte"; @@ -30,6 +31,7 @@ + diff --git a/src/lib/browse/colors.ts b/src/lib/browse/colors.ts index d15867ee3..5c63f922d 100644 --- a/src/lib/browse/colors.ts +++ b/src/lib/browse/colors.ts @@ -14,6 +14,14 @@ export const colors = { bus_route_without_lane: "#C2A6D8", cycle_parking: "black", + // Thanks to https://github.com/cyipt/cyipt-website/issues/23 + cycle_paths: { + track: "#0000FF", + lane: "#009FEF", + shared_use_segregated: "#FF9900", + shared_use_unsegregated: "#E7E700", + }, + // Color ramp from https://www.ons.gov.uk/census/maps/choropleth sequential_low_to_high: [ "#CDE594", diff --git a/src/lib/browse/layers/CyclePathsLayerControl.svelte b/src/lib/browse/layers/CyclePathsLayerControl.svelte new file mode 100644 index 000000000..8750ea211 --- /dev/null +++ b/src/lib/browse/layers/CyclePathsLayerControl.svelte @@ -0,0 +1,148 @@ + + + + Cycle paths + + +

+ This shows different types of cycle path, according to OpenStreetMap (as + of 15 August 2023). +

+
    +
  • + Separated tracks + include fully or partly segregated cycletracks alongside a carriageway, + stepped cycletracks, and tracks off the carriageway entirely. They're also + separated from foot traffic. +
  • +
  • + Unprotected lanes + are mandatory or advisory lanes on the carriageway, without any physical + protection. They do not included shared bus lanes. +
  • +
  • + Shared-use + paths are split between cycle and foot traffic, and are separated from + motor traffic somehow. There can be segregation between cyclists and pedestrians + or not. +
  • +
+

+ Note there are many known limitations with this layer. Data in + OpenStreetMap can be missing, mapped twice, or mapped incorrectly. Our + processing is also imperfect. You can click a segment to see full + OpenStreetMap data. Please do report issues with the classification or + data. +

+

+ License: + Open Data Commons Open Database License + +

+
+
+
+{#if show} + {#each legend as [label, color]} +
+ + {label} +
+ {/each} +{/if} + + diff --git a/src/maplibre_helpers.ts b/src/maplibre_helpers.ts index 2410b6d56..b2bd887cb 100644 --- a/src/maplibre_helpers.ts +++ b/src/maplibre_helpers.ts @@ -319,6 +319,7 @@ const layerZorder = [ "bus_routes", "railway_stations", "cycle_parking", + "cycle_paths", // Polygons are bigger than lines, which're bigger than points. When geometry // overlaps, put the smaller thing on top @@ -355,9 +356,10 @@ const layerZorder = [ "route-lines", "route-polygons", - // Draw most things beneath text road labels. This is the only layer in this - // list generated by the MapTiler basemap we use. + // Draw most things beneath text road labels. These IDs come from the + // MapTiler basemap, and there are different ones for each basemap. "road_label", + "Road labels", // Draw the inverted boundary fade on top of basemap labels "boundary",