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

Unrecognized field min_tile_cover_size [BUG] #961

Closed
quincylvania opened this issue Jul 23, 2024 · 5 comments · Fixed by #967
Closed

Unrecognized field min_tile_cover_size [BUG] #961

quincylvania opened this issue Jul 23, 2024 · 5 comments · Fixed by #967
Labels
bug Something isn't working

Comments

@quincylvania
Copy link
Contributor

I'm trying to use a custom schema something like this:

sources:
  osm:
    type: osm
    local_path: data/sources/planet.osm.pbf
layers:
  - id: trail_poi
    features:
      - source: osm
        geometry: polygon_centroid_if_convex
        min_zoom: 4
        min_tile_cover_size: 0.2
        include_when:
          leisure:
            - park
        attributes:
          - key: leisure
            tag_value: leisure

But when I try to use min_tile_cover_size I run into this error:

Exception in thread "main" java.lang.IllegalArgumentException: Unrecognized field "min_tile_cover_size" (class com.onthegomap.planetiler.custommap.configschema.FeatureItem), not marked as ignorable (8 known properties: "min_zoom", "include_when", "geometry", "attributes", "source", "max_zoom", "exclude_when", "min_size"])

I guess the value is probably missing from configschema/FeatureItem.java? It's listed in configschema/AttributeDefinition.java, possibly that's a mistake? Not sure exactly what's going on.

@msbarry
Copy link
Contributor

msbarry commented Jul 29, 2024

It looks like the docs and json schema are wrong here. There's a min_tile_cover_size tag on attribute definitions that exclude adding the attribute to features when they are too small, and a min_size tag (in tile pixels) on features to not include them when they are too small. You should be able to just switch to min_size to get this working.

We should update the docs/json schema but also they should probably each just have a min_size tag with a way to specify whether the unit is pixels, tiles, etc... it's kind of strange to have a unit of "tiles" on attribute features and "pixels" on entire features.

@quincylvania
Copy link
Contributor Author

quincylvania commented Jul 29, 2024

Oh okay, I thought min_size was in absolute meters or something since the units aren't given. It's not clear to me what it means by "below the maximum zoom-level of the map". But if the value is relative to the tile size then that will work for my use case :)

@msbarry
Copy link
Contributor

msbarry commented Jul 30, 2024

Ah yeah the default unit is "tile pixels" which might be a little counter-intuitive. Ideally I think you should be able to express min_size (or max_size) in an absolute unit like meters, acres, hectares, miles or also in a unit that varies by zoom level like pixels or tiles.

@msbarry
Copy link
Contributor

msbarry commented Jul 30, 2024

"below the maximum zoom-level of the map".

For most maps this is zoom=14 but if you run with --maxzoom=10 then it will be 10. Setting min_size=1 filters-out features below 1 pixel in size up z=maxzoom-1, but at z=maxzoom it lets through all features since the client will overzoom tiles at that highest zoom level.

@quincylvania
Copy link
Contributor Author

@msbarry Thanks for the clarifications!

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

Successfully merging a pull request may close this issue.

2 participants