[Feature] Typo-tolerance for `__all__` and `__any__`
Describe the bug
I'm unable to use '${ feature.point_along_line(0) != feature.point_along_line(1) }' in an include_when expression.
Following this Slack discussion and PR #1163
To Reproduce
The YAML schema below defines 3 layers:
pier_not_closedis expected to capture all piers that are not a closed linepier_closedis expected to capture all piers that are a closed linepier_allis expected to capture all piers regardless of their closeness
- Save the following schema in
pier.yaml
schema_name: pier
schema_description: Example of "is_closed"-like expressions in `include_when`
attribution: <a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>
args:
area:
description: Geofabrik area to download
default: monaco
osm_url:
description: OSM URL to download
default: '${ args.area == "planet" ? "aws:latest" : ("geofabrik:" + args.area) }'
sources:
osm:
type: osm
url: '${ args.osm_url }'
layers:
- id: pier_not_closed
features:
- source: osm
geometry: line
include_when:
- __all___:
- man_made: pier
- '${ feature.point_along_line(0) != feature.point_along_line(1) }'
- id: pier_closed
features:
- source: osm
geometry: line
include_when:
- __all___:
- man_made: pier
- '${ feature.point_along_line(0) == feature.point_along_line(1) }'
- id: pier_all
features:
- source: osm
geometry: line
include_when:
- man_made: pier
- Run using the latest Planetiler docker version currently available
docker run --rm -v "$(pwd):/w" -w /w ghcr.io/onthegomap/planetiler@sha256:2d3a4bd0b8ba16250d21b127d2e03b96f2517a9a3f99769b40ce27df760ad14e pier.yaml --output pier.pmtiles --download
- The log file says both
pier_not_closedandpier_closedlayers are empty:
0:00:04 DEB [archive] - Max tile sizes
z11 z12 z13 z14 all
pier_all 41 41 41 41 41
full tile 41 41 41 41 41
gzipped 63 63 63 63 63
- The log file says the
pier_alllayer has 1 feature in each of the 4 tiles produced
0:00:04 DEB [archive] - # tiles: 4
0:00:04 DEB [archive] - # features: 4
Most likely, the feature is way 879006855 - a closed way that does not have an area=yes attribute
Expected behavior
- For the current mapping of Monaco, having one closed pier way, I would expect
pier_closedto have the same contents aspier_all. - Generally, i would expect each feature in
pier_allto appear in eitherpier_not_closedorpier_closed.
Environment:
- Hardware: Lenovo Legion
- OS: WSL
- Java version and distribution: As used in the docker image
- Maven version: As used in the docker image
It looks like you have an extra underscore at the end of __all___ - what happens if you remove that?
You're absolutely right! I wish that there was a syntax error of some sort on such a typing error.
When using __all__, the output is as expected:
z11 z12 z13 z14 all
pier_all 41 41 41 41 41
pier_closed 44 44 44 44 44
full tile 85 85 85 85 85
gzipped 78 78 78 78 78
and
0:00:04 DEB [archive] - # tiles: 4
0:00:04 DEB [archive] - # features: 8
IMO, a syntax error would be just fine.