Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Match issue #1164

Open
zstadler opened this issue Feb 1, 2025 · 2 comments
Open

[BUG] Match issue #1164

zstadler opened this issue Feb 1, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@zstadler
Copy link
Contributor

zstadler commented Feb 1, 2025

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_closed is expected to capture all piers that are not a closed line
  • pier_closed is expected to capture all piers that are a closed line
  • pier_all is expected to capture all piers regardless of their closeness
  1. 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">&copy; 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
  1. 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
  1. The log file says both pier_not_closed and pier_closed layers 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
  1. The log file says the pier_all layer 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_closed to have the same contents as pier_all.
  • Generally, i would expect each feature in pier_all to appear in either pier_not_closed or pier_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
@zstadler zstadler added the bug Something isn't working label Feb 1, 2025
@msbarry
Copy link
Contributor

msbarry commented Feb 2, 2025

It looks like you have an extra underscore at the end of __all___ - what happens if you remove that?

@zstadler
Copy link
Contributor Author

zstadler commented Feb 2, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants