POC: Geometry scale - #6896
Draft
teunbrand wants to merge 2 commits into
Draft
Conversation
teunbrand
marked this pull request as draft
September 6, 2026 10:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is merely a POC of what a geometry scale could look like.
It is 'bring your own spatial data', but the rest is done just via identifiers from that data.
The scale works by having the translation from identifiers to geometry at the scale transformation level.
Scale transformations play out before stat computations, so
stat_sf()has the correct data to determine the bounding box.There are no guides or other reasons to ever inverse-transform the data, so I think this is somewhat fine.
It currently has two big limitations:
coord_sf(crs). For normalgeom_sf(), this happens in theCoordSf$setup_data()step, which runs before scale transformation, so the translated geometry misses out on that step. It can maybe be moved tostat_sf(), but that'd be somewhat more invasive.scale_type()mechanism to automatically detect scales isn't rigged to detect non-sfc classgeometryaesthetic. The detection of missing scales runs after scale transformation takes place, so even if we rig upscale_type()correctly, the order of orchestration still gets in the way.Here are the rendered examples
Created on 2026-09-06 with reprex v2.1.1