From 8689e0b47410bafc0633dcda4729cc919c0425df Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Thu, 15 Aug 2024 09:34:37 -0400 Subject: [PATCH] Add nordic ski trail layer (close #34) --- README.md | 1 + index.html | 3 +++ js/index.js | 17 ++++------------- js/mapController.js | 42 ++++++++++++++++++++++++++++-------------- 4 files changed, 36 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 48e8043..73e7cd4 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ The following styles show allowed trail access for different travel modes. Dark - Bicycle Trails ([`bicycle`](https://wiki.openstreetmap.org/wiki/Key:bicycle) access) - Horseback Riding Trails ([`horse`](https://wiki.openstreetmap.org/wiki/Key:horse) access) - ATV Trails ([`atv`](https://wiki.openstreetmap.org/wiki/Key:atv) access) +- Cross-Country Ski Trails ([`ski:nordic`](https://wiki.openstreetmap.org/wiki/Key:ski:nordic) access) - Snowmobile Trails ([`snowmobile`](https://wiki.openstreetmap.org/wiki/Key:snowmobile) access) The following styles highlight the presence and values of trail attribute tags. Purple lines mean an attribute is missing, incomplete, or needs review, while teal lines indicate the attribute is good to go. diff --git a/index.html b/index.html index 1df6fed..7eb5657 100644 --- a/index.html +++ b/index.html @@ -49,6 +49,9 @@

< + + + diff --git a/js/index.js b/js/index.js index a6f59db..24eb3c6 100644 --- a/js/index.js +++ b/js/index.js @@ -65,16 +65,6 @@ let lensStrings = { label: "Hand Cart" }, } - -const travelModes = [ - "foot", - "wheelchair", - "bicycle", - "horse", - "atv", - "canoe", - "snowmobile", -]; const metadataLenses = { label: "Metadata", subitems: [ @@ -114,7 +104,7 @@ const allLensOptions = [ }, metadataLenses, ]; -const wheelchairLensOptions = [ +const basicLensOptions = [ { label: "Attributes", subitems: [ @@ -128,7 +118,7 @@ const wheelchairLensOptions = [ "smoothness", "surface", "trail_visibility", - "width", + "width", ] }, metadataLenses, @@ -215,7 +205,8 @@ const lensOptionsByMode = { "foot": hikingLensOptions, "horse": vehicleLensOptions, "snowmobile": vehicleLensOptions, - "wheelchair": wheelchairLensOptions, + "ski:nordic": basicLensOptions, + "wheelchair": basicLensOptions, }; function lensesForMode(travelMode) { return lensOptionsByMode[travelMode].flatMap(function(item) { diff --git a/js/mapController.js b/js/mapController.js index e8d1b2e..6cab251 100644 --- a/js/mapController.js +++ b/js/mapController.js @@ -91,6 +91,7 @@ const impliedYesExpressions = { wheelchair: [], canoe: [], portage: [], + 'ski:nordic': [], snowmobile: [], }; @@ -104,15 +105,6 @@ const impliedNoExpressions = { isNotHighwayExpression, ] ], - snowmobile: [ - [ - "any", - ["in", "highway", "footway", "steps"], - ["in", "vehicle", "no", "private", "discouraged"], - ["in", "motor_vehicle", "no", "private", "discouraged"], - isNotHighwayExpression, - ] - ], bicycle: [ [ "any", @@ -125,14 +117,11 @@ const impliedNoExpressions = { isNotHighwayExpression, ] ], - foot: [ - isNotHighwayExpression, - ], canoe: [ ["!has", "canoe"], ], - portage: [ - ["!has", "portage"], + foot: [ + isNotHighwayExpression, ], horse: [ [ @@ -141,6 +130,25 @@ const impliedNoExpressions = { isNotHighwayExpression, ], ], + portage: [ + ["!has", "portage"], + ], + 'ski:nordic': [ + [ + "any", + ["in", "ski", "no", "private", "discouraged"], + isNotHighwayExpression, + ] + ], + snowmobile: [ + [ + "any", + ["in", "highway", "footway", "steps"], + ["in", "vehicle", "no", "private", "discouraged"], + ["in", "motor_vehicle", "no", "private", "discouraged"], + isNotHighwayExpression, + ] + ], wheelchair: [ [ "any", @@ -821,6 +829,7 @@ let accessHierarchy = { horse: ['horse'], mtb: ['vehicle', 'bicycle', 'mtb'], portage: ['foot', 'portage'], + 'ski:nordic': ['foot', 'ski', 'ski:nordic'], snowmobile: ['vehicle', 'motor_vehicle', 'snowmobile'], wheelchair: ['foot', 'wheelchair'], }; @@ -1223,6 +1232,8 @@ function updateTrailLayers() { modeIsAllowedExpression("bicycle"), modeIsAllowedExpression("horse"), modeIsAllowedExpression("atv"), + modeIsAllowedExpression("snowmobile"), + modeIsAllowedExpression("ski:nordic"), modeIsAllowedExpression("canoe"), ]; } else { @@ -1248,6 +1259,9 @@ function updateTrailLayers() { ["!=", "bicycle", "unknown"], ["!=", "horse", "unknown"], ["!=", "atv", "unknown"], + ["!=", "portage", "unknown"], + ["!=", "snowmobile", "unknown"], + ["!=", "ski:nordic", "unknown"], ]; }