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

Expose min_size in configurable schema #421

Merged
merged 4 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Expose in configurable schema
  • Loading branch information
wipfli committed Dec 20, 2022
commit e0fdb416b3afd99c55df8a92237e639428fec2cb
1 change: 1 addition & 0 deletions planetiler-custommap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,7 @@ docker run -v "$(pwd)/data":/data ghcr.io/onthegomap/planetiler:latest verify /d
- `geometry` - Geometry type of the expected output feature.
- `min_zoom` - Min zoom level that the output feature appears in.
- `max_zoom` - Max zoom level that the output feature appears in.
- `min_pixel_size` - Minimum length of line features or square root of the minimum area of polygon features to emit below the maximum zoom-level of the map.
wipfli marked this conversation as resolved.
Show resolved Hide resolved
- `tags` - Attributes expected on the output vector tile feature, or `null` if the attribute should not be set. Use
`allow_extra_tags: true` to fail if any other tags appear besides the ones specified here.
- `allow_extra_tags` - If `true`, then fail when extra attributes besides tags appear on the output feature.
Expand Down
4 changes: 4 additions & 0 deletions planetiler-custommap/planetilerspec.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
"description": "Max zoom level that the output feature appears in",
"type": "integer"
},
"min_pixel_size": {
"description": "Minimum length of line features or square root of the minimum area of polygon features to emit below the maximum zoom-level of the map",
"type": "double"
},
msbarry marked this conversation as resolved.
Show resolved Hide resolved
"tags": {
"description": "Attributes expected on the output vector tile feature, or null if the attribute should not be set. Use allow_extra_tags: true to fail if any other tags appear besides the ones specified here",
"oneOf": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public ConfiguredFeature(String layer, TagValueProducer tagValueProducer, Featur
}
processors.add(makeFeatureProcessor(feature.minZoom(), Integer.class, Feature::setMinZoom));
processors.add(makeFeatureProcessor(feature.maxZoom(), Integer.class, Feature::setMaxZoom));
processors.add(makeFeatureProcessor(feature.minPixelSize(), Double.class, Feature::setMinPixelSize));
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want some kind of test for this in ConfiguredFeatureTest to make sure it's wired-up properly.


featureProcessors = processors.stream().filter(Objects::nonNull).toList();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public record FeatureItem(
@JsonFormat(with = JsonFormat.Feature.ACCEPT_SINGLE_VALUE_AS_ARRAY) List<String> source,
@JsonProperty("min_zoom") Object minZoom,
@JsonProperty("max_zoom") Object maxZoom,
@JsonProperty("min_pixel_size") Object minPixelSize,
@JsonProperty(required = true) FeatureGeometry geometry,
@JsonProperty("include_when") Object includeWhen,
@JsonProperty("exclude_when") Object excludeWhen,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public record OutputFeature(
GeometryType geometry,
@JsonProperty("min_zoom") Integer minZoom,
@JsonProperty("max_zoom") Integer maxZoom,
@JsonProperty("min_pixel_size") Double minPixelSize,
Copy link
Contributor

Choose a reason for hiding this comment

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

can you also add a test to SchemaValidatorTest to make sure this is being compared in the tests?

@JsonProperty("at_zoom") Integer atZoom,
@JsonProperty("allow_extra_tags") Boolean allowExtraTags,
@JsonProperty("tags") Map<String, Object> tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ layers:
- source: osm
geometry: line
# TODO get min admin level from relations
min_pixel_size: 0.0
min_zoom:
default_value: 7
overrides:
Expand Down Expand Up @@ -379,6 +380,7 @@ layers:
features:
- source: osm
geometry: line
min_pixel_size: 0.0
min_zoom:
default_value: 13
overrides:
Expand Down