Skip to content

Graticules and limits read scales#495

Open
teunbrand wants to merge 3 commits into
posit-dev:mainfrom
teunbrand:scale_to_projection
Open

Graticules and limits read scales#495
teunbrand wants to merge 3 commits into
posit-dev:mainfrom
teunbrand:scale_to_projection

Conversation

@teunbrand

Copy link
Copy Markdown
Collaborator

This PR aims to fix #492.

It hooks up the position scales to the map projections. The breaks hook into the graticule and the limits hook into the bbox.
Essentially the priority order of the bbox is now: data < scales < bounds setting. The procedure essentially this: if scale limits exist, then transform data bbox to lon/lat and apply scales independently, then retransform the scaled bbox back to the target CRS. You'll run into some limitations with heavily distorting projections, but at that point it'd be better to use the bounds setting anyway.

teunbrand and others added 3 commits June 29, 2026 14:18
SCALE lon/lat FROM [...] now overrides the data-derived bbox for viewport
extent, and SCALE lon/lat SETTING breaks => [...] controls graticule line
placement. Scale limits sit between data extent and PROJECT bounds in the
precedence chain. Per-element fallback allows partial constraints (e.g.
FROM (null, 40) constrains only the upper bound). OOB filtering is skipped
for map position scales since their limits are in EPSG:4326 while data
columns contain projected coordinates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Unit tests for scale_override_bbox (numeric limits, string limits, no
explicit limits, mixed null/numeric) and scale_breaks (explicit array,
numeric count ignored, absent, wrong aesthetic). Integration tests verify
the full DuckDB path: scale limits constrain the projected bbox, and
explicit breaks produce the expected number of graticule meridians.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@teunbrand teunbrand requested a review from thomasp85 June 29, 2026 13:03

@thomasp85 thomasp85 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be nice if the graticule_breaks use would flow automatically from some sort of spatial transform on the scale but I can understand why that would be hard to detect for little gain

E.g. SCALE lat VIA spatial would give you a graticule breaks function and the spatial transform was default for lat and long aesthetics...

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.

Hook up lon/lat scales to map projections

2 participants