Graticules and limits read scales#495
Open
teunbrand wants to merge 3 commits into
Open
Conversation
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>
thomasp85
approved these changes
Jun 29, 2026
thomasp85
left a comment
Collaborator
There was a problem hiding this comment.
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...
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 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.