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

Declarative schema from configuration file #160

Merged
merged 241 commits into from
Jun 7, 2022

Conversation

ZeLonewolf
Copy link
Contributor

@ZeLonewolf ZeLonewolf commented Apr 8, 2022

Fixes #18

This PR provides the ability for a user to specify an arbitrary vector schema via a configuration file. Configuration is via a YML file which specifies the contents of the configured layers. Documentation for the schema definition format is provided in planetiler-custommap/README.md.

The schema language allows for the following features:

  • Ability to define layers and features within layers based on tag filters
  • Ability to specify attributes as a function of tags
  • Ability to specify feature zoom levels as a function of tagging or feature area
  • Ability to specify data sources in a configuration file

A collection of unit tests are provided, as well as a sample schema intended to support OWG vector tile exploration under openstreetmap/operations#565

A typical invocation looks something like:

(java/docker launch) generate-custom --schema=schema_file.yml --download --area=rhode-island

This PR does not include handling for line merging, which needs a deeper investigation to deal with attributes that have minimum zooms greater than the overall feature minimum zoom, which would allow certain linestring features to merge only at certain lower zooms.

@msbarry msbarry mentioned this pull request Jun 2, 2022
28 tasks
Copy link
Contributor

@msbarry msbarry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Pushed a couple of minor changes and added #247 to track some followup tasks after this lands. I'll plan to merge a couple of other in-flight changes, put out a 0.5.0 release then land this PR.

Collection<String> sources,
@JsonProperty("min_zoom") Integer minZoom,
@JsonProperty("max_zoom") Integer maxZoom,
GeometryType geometry,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will we specify other geometry accessors like centroid eventually? Would that be a different value for geometry? Or an additional flag so you can vary the source feature geometry type and accessor function separately?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be a flag or enumeration. A centroid is still a representation of an area IMO.

ZeLonewolf and others added 2 commits June 7, 2022 09:31
Add local_path to example test case
@sonarcloud
Copy link

sonarcloud bot commented Jun 7, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

89.0% 89.0% Coverage
0.0% 0.0% Duplication

@msbarry msbarry merged commit da12fef into onthegomap:main Jun 7, 2022
@ZeLonewolf ZeLonewolf deleted the owg_schema branch June 7, 2022 21:42
@fphilippe
Copy link

Hi everyone, I've understood that this PR is already integrated the main base code ? Do you know when a release will be compiled ?

@wipfli
Copy link
Contributor

wipfli commented Nov 15, 2022

I think it is already released. Try something like the following:

mkdir data/
cd data/
wget https://raw.githubusercontent.com/onthegomap/planetiler/main/planetiler-custommap/src/main/resources/samples/shortbread.yml
cd ..
docker run -v "$(pwd)/data":/data ghcr.io/onthegomap/planetiler:latest generate-custom --schema=/data/shortbread.yml --download

@fphilippe
Copy link

Thank you @wipfli for your quick answer. I got it, but the jar file is not available in releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE] config-based profiles
4 participants