Skip to content

Commit

Permalink
Filter water trail pois to focus area
Browse files Browse the repository at this point in the history
  • Loading branch information
quincylvania committed Jul 31, 2024
1 parent fa0af46 commit 4931d10
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions js/mapController.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,20 @@ function isSpecifiedExpressionForLens(lens, travelMode) {
return specifiedAttributeExpression;
}

function waterTrailPoisFilter(travelMode) {
var filter = ["all"];
if (focusAreaGeoJson?.geometry?.coordinates?.length) {
filter.push(["within", focusAreaGeoJson]);
}
if (travelMode !== "canoe") {
filter.push([
"any",
["==", ["get", "waterway"], "waterfall"],
])
}
return filter.length > 1 ? filter : null;
}

function trailPoisFilter(travelMode) {
var filter = [
"all",
Expand Down Expand Up @@ -1347,10 +1361,7 @@ function updateTrailLayers() {
.setFilter('trails-qa', ["all", showFixmesExpression, combinedFilterExpression])
.setFilter('trails-labels', combinedFilterExpression)
.setFilter('trails-pointer-targets', combinedFilterExpression)
.setFilter('water-trail-pois', travelMode !== "canoe" ? [
"any",
["==", ["get", "waterway"], "waterfall"],
] : null)
.setFilter('water-trail-pois', waterTrailPoisFilter(travelMode))
.setFilter('trail-pois', trailPoisFilter(travelMode))
.setFilter('major-trail-pois', [
"all",
Expand Down

0 comments on commit 4931d10

Please sign in to comment.