Expose label grid functions for custommap/YAML profiles#1477
Expose label grid functions for custommap/YAML profiles#1477phanecak-maptiler wants to merge 136 commits into
Conversation
…h (needed only for test branch)
Full logs: https://github.com/onthegomap/planetiler/actions/runs/27505499244 |
| @JsonProperty("point_label_grid_pixel_size") PointLabelGridPixelSize pointLabelGridPixelSize, | ||
| @JsonProperty("point_label_grid_limit") PointLabelGridLimit pointLabelGridLimit, |
There was a problem hiding this comment.
Let's make a single "point_label_grid" attribute that is a struct with "pixel_size" and "limit" attrbitutes. "pixel_size" and "limit" should eventually be able to just be a number, value+minzoom, or expression based on feature attributes and zoom, but if we just support value+minzoom for now then we can add support for other variants later.
point_label_grid:
pixel_size:
minzoom: 8
value: 32
limit:
minzoom: 8
value: 64There was a problem hiding this comment.
Adjusted.
Side note: But kept maxzoom naming, since that matches naming of parameters in setPointLabelGridPixelSize() and setPointLabelGridLimit().
|
Also could you add the new config fields we land on here and the new "id" field from #1469 to custommap README and planetiler.schema.json file? |
| @CsvSource({ | ||
| "sort_key: 100 }, 100", | ||
| "sort_key: ${ feature.id }, 1", | ||
| "sort_key_descending: 100 }, -101", |
There was a problem hiding this comment.
I don't quite follow why do these have a } ?
There was a problem hiding this comment.
Hmm, I guess some typo. Removed.
| <TEST INPUT> | ||
| """.replace("<TEST INPUT>", input); |
There was a problem hiding this comment.
Minor:
| <TEST INPUT> | |
| """.replace("<TEST INPUT>", input); | |
| %s | |
| """.formatted(input); |
There was a problem hiding this comment.
Yup, nicer/better. Thanks. Adjusted.
| processors.add(makeFeatureProcessor(feature.pointLabelGrid(), PointLabelGrid.class, | ||
| (f, a) -> { | ||
| f.setPointLabelGridPixelSize(ZoomFunction.maxZoom(a.pixelSize().maxZoom(), a.pixelSize().value())); | ||
| f.setPointLabelGridLimit(ZoomFunction.maxZoom(a.limit().maxZoom(), a.limit().value())); | ||
| })); |
There was a problem hiding this comment.
These could technically be set independently. Could we break this up into 2 feature processors, one for pixelsize and one for limit?
There was a problem hiding this comment.
Adjusted.
|
|
|
|
Sorry, merged my testing |



This PR exposes "label grid" related functions for custommap/YAML profiles:
pointLabelGridPixelSize()pointLabelGridLimit()sortKey()sortKeyDescending()Those are needed for layers with many points for "label grid" point density limiting.
Usage example: