Skip to content

Commit

Permalink
Add mountain bike trails view (close #50)
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Aug 20, 2024
1 parent 7c705fb commit 4839f33
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ The following styles show allowed trail access for different travel modes. Dark

- Hiking & Walking Trails ([`foot`](https://wiki.openstreetmap.org/wiki/Key:foot) access)
- Wheelchair Trails ([`wheelchair`](https://wiki.openstreetmap.org/wiki/Key:wheelchair) access)
- Bicycle Trails ([`bicycle`](https://wiki.openstreetmap.org/wiki/Key:bicycle) access)
- Biking Trails ([`bicycle`](https://wiki.openstreetmap.org/wiki/Key:bicycle) access)
- Mountain Biking Trails ([`mtb`](https://wiki.openstreetmap.org/wiki/Key:mtb) access)
- Inline Skating Trails ([`inline_skates`](https://wiki.openstreetmap.org/wiki/Key:inline_skates) access)
- Horseback Riding Trails ([`horse`](https://wiki.openstreetmap.org/wiki/Key:horse) access)
- ATV Trails ([`atv`](https://wiki.openstreetmap.org/wiki/Key:atv) access)
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ <h1 style="display:flex;"><span style="flex-basis: 100%;"><span class="swatch"><
<option value="foot">Hiking & Walking Trails</option>
<option value="wheelchair">Wheelchair Trails</option>
<option value="bicycle">Biking Trails</option>
<option value="mtb">Mountain Biking Trails</option>
<option value="inline_skates">Inline Skating Trails</option>
<option value="horse">Horseback Riding Trails</option>
<option value="atv">ATV Trails</option>
Expand Down
1 change: 1 addition & 0 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ const lensOptionsByMode = {
"all": allLensOptions,
"atv": vehicleLensOptions,
"bicycle": vehicleLensOptions,
"mtb": vehicleLensOptions,
"canoe": canoeLensOptions,
"foot": hikingLensOptions,
"horse": vehicleLensOptions,
Expand Down
13 changes: 12 additions & 1 deletion js/mapController.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ const impliedYesExpressions = {
["in", "surface", "paved", "asphalt", "concrete"],
]
],
mtb: [],
portage: [],
'ski:nordic': [],
snowmobile: [],
Expand Down Expand Up @@ -160,6 +161,14 @@ const impliedNoExpressions = {
isNotHighwayExpression,
],
],
mtb: [
[
"any",
["in", "vehicle", "no", "private", "discouraged"],
["in", "bicycle", "no", "private", "discouraged"],
isNotHighwayExpression,
],
],
portage: [
["!has", "portage"],
],
Expand Down Expand Up @@ -524,7 +533,7 @@ function loadTrailLayers() {
"source-layer": "trail",
"type": "symbol",
"layout": {
"text-field": ["coalesce", ['get', 'name'], ['get', 'waterbody:name']],
"text-field": ["coalesce", ['get', 'name'], ['get', 'mtb:name'], ['get', 'waterbody:name']],
"text-font": ["Americana-Regular"],
"text-size": 13,
"symbol-placement": "line"
Expand Down Expand Up @@ -1268,6 +1277,7 @@ function updateTrailLayers() {
modeIsAllowedExpression("bicycle"),
modeIsAllowedExpression("horse"),
modeIsAllowedExpression("atv"),
modeIsAllowedExpression("mtb"),
modeIsAllowedExpression("inline_skates"),
modeIsAllowedExpression("snowmobile"),
modeIsAllowedExpression("ski:nordic"),
Expand Down Expand Up @@ -1296,6 +1306,7 @@ function updateTrailLayers() {
["!=", "bicycle", "unknown"],
["!=", "horse", "unknown"],
["!=", "atv", "unknown"],
["!=", "mtb", "unknown"],
["!=", "inline_skates", "unknown"],
["!=", "portage", "unknown"],
["!=", "snowmobile", "unknown"],
Expand Down

0 comments on commit 4839f33

Please sign in to comment.