maplibre-style-spec
maplibre-style-spec copied to clipboard
Add intersection decision operator(s)
Design Proposal: Add intersection decision operator(s)
Motivation
Over at osmus/OpenTrailMap we're adding the ability to filter trail data to a specific park. In MapLibre we can filter POIs easily with the within
operator. However, we also want to filter trails. within
works for lines, but it will exclude lines that are not strictly contained, so we would lose any that cross the border of the park.
Proposed Change
Adding one or more spatial relationship operators dealing with intersection would fulfill the need, namely intersects
(the boundary and interior of the feature intersects the boundary or interior of the other).
API Modifications
Add one or more decision operators.
Migration Plan and Compatibility
The feature would be purely additive and does not impact current users.
Rejected Alternatives
We could buffer the bounding feature a bit before applying within
, but we'd risk losing very long lines, and we might include cruft we don't want. We could theoretically preprocess trails to split them at park boundaries when rendering tiles, but that seems like overkill. We could not filter lines at all, but that sort of defeats the purpose of focusing on a specific park and looks messy. In the below example, POIs are filtered to the dark green area while trails are not.