You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(render): a generalisation's pad read in place is cut to what fits at the view's level and said, and one out of range in a file is set and said (#3145) - #3443
Part of #3145. Follows #3434 (part 2), whose review asked for two things after it: a cap on the read-in-place pad of a generalised relief, with what is drawn said, and a notice for a generalize out of range in a file.
A GeoTIFF read in place: the pad is cut, not the resolution
Since #3434 a part read in place is padded by the generalisation's reach, about three Gaussians in the level's pixels. When that pad makes the part more than the tiles kept can hold at the level the view needs, the read moved to a coarser level, and the map and exports said "the view is too large a part of the image to read at the resolution it needs", which is not why. #3434's body measured it: a 1920 × 1080 view of a 1 m DEM at 10 km has a pad of about 30 000 pixels and was read from level 4, 16 times coarser.
Now, at the level the view needs, the pad is cut to the largest that fits (a halving search between the pad without the generalisation and the full one), so the view keeps its resolution. Near the view's edges the smoothing then reads fewer cells than its reach. That is drawn and said, as any part drawn from less than it needs is: the map shows it and says its generalisation reaches farther past the view than can be read at the resolution it needs, so near the view's edges it is smoothed from fewer cells: a smaller generalisation or a smaller view draws it whole; an export refuses it with that reason. When even the pad without the generalisation doesn't fit, the read moves to a coarser level as before, with its own reason.
At the sizes the issue works with (60–120 m on 30 m cells) the pad is 7–13 pixels and nothing changes.
A generalize out of range in a file
raster.symbology takes 0 to 10 km; a file written by hand can hold anything, and #3434 drew it as the nearest (past 10 km, 10 km; below 0 or not a number, none) without a word. Now, as a project opens, as maps are imported, as a layer file (or group file) is added and as an offline area's map opens (its snapshot isn't checked when the project is read), such a value is set to what is drawn and said, with the layers, their maps and how many: dem in Map (25000 m, now 10000 m): its Shaded Relief's generalisation was outside 0 to 10000 m, so it is set to the nearest it can be. A style file takes no raster's style, so none reaches a layer from style.import (tested). Saved again, the file holds what is drawn, for the project's maps. An offline area's stored snapshot is set and said when its map opens, and the snapshot itself stays as written until then (the map opened from it holds the value drawn).
Tests
Each written first, failing before its change:
a_generalisation_reaching_past_what_fits_is_cut_at_the_level_needed_and_said (engine): a 4096-pixel GeoTIFF of three bands stored together, served by ranges, exported at 768 pixels a side at the resolution of its full level. At 1 km it is written; at 10 km the export is refused by its generalisation, not as a view too large (it was refused as a view too large before, read from a coarser level).
a_generalisation_out_of_range_in_a_file_is_set_within_it_and_said (engine): the fixture schema/fixtures/shaded_relief_generalize_out_of_range.rgis (1e20 and −5, as written by hand) opens with 10 km and none, said once with each layer and its map; a map imported with 1e20, a layer file added with −5 and an offline area's map opened with 1e20 are set and said too; a style file's import takes none; a project in range says nothing.
cargo fmt, clippy -D warnings (render, engine, all targets), cargo xtask schema --check and cargo xtask commands (unchanged) pass. render 1113 and engine lib 3042 pass; the engine integration test portable_projects::reload::wrong_geometry_missing_file_and_missing_chosen_table_leave_the_layer_unchanged fails locally on Windows on main too and doesn't touch rasters.
No i18n change.
Size: 198 changed lines (+186 −12), about 110 of them tests; it grew from 167 in review.
Out-of-range Shaded Relief generalisation values are adjusted to the supported range when opening a project or offline map, importing a map, or adding layers. Notices identify affected layers; in-range values do not trigger a notice.
Rendering reports when smoothing is reduced near view edges to fit the available data.
Tests
Added coverage for value adjustments, notices, and export behavior at supported and unsupported generalisation levels.
…s at the view's level and said, and one out of range in a file is set and said (opengeos#3145)
- A GeoTIFF read in place whose generalisation's pad doesn't fit the
tiles kept at the level the view needs is read there with the largest
pad that fits, rather than from a coarser level, and says so by its
generalisation (the map shows it, an export refuses it); before, it
was read coarser and said as a view too large.
- A Shaded Relief's generalize outside 0 to 10 km in a file is set to
what is drawn as a project opens, maps are imported and layer files
are added, and said with the layers and how many.
Part of opengeos#3145.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
No actionable comments were generated in the recent review.
Walkthrough
The change clamps out-of-range Shaded Relief generalization values during project, map, offline-map, and layer operations. Raster drawing selects a fitting generalization pad when the full pad does not fit and reports when smoothing reach is reduced.
A helper clamps out-of-range Shaded Relief generalization values and reports affected layers. Project reset, map import, offline-map creation, and layer addition call the helper. Tests cover clamping, notices, in-range values, and the fixture values above and below the allowed range.
Fit raster windows to generalization pads crates/render/src/raster.rs, crates/engine/src/tests.rs
Raster drawing selects a reduced pad when the full generalization pad does not fit. It reports GENERALISE_CUT when drawing uses reduced smoothing reach. An export test checks generalization values.
RustGIS issue 3145: The issue concerns the Shaded Relief generalize setting, which this change bounds and uses when selecting the raster read pad.
Possibly related PRs
opengeos/RustGIS#1339: Both changes modify the raster read-in-place path, including behavior when a suitable overview or window does not fit.
Suggested reviewers:giswqs
Merge Risk: Minimal · up to 7d0c0
The change clamps out-of-range shaded-relief generalize values on open and caps the raster read pad so views keep a finer level. No concrete merge-blocking risk was found.
Pre-merge checks: 3 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Description check
The description follows the template's main purpose and fills in the Summary and Testing sections in substance. It explains what changed and why: a GeoTIFF read in place now caps the generalisation pa…
Fill in the 'UI evidence' section. The PR adds new user-visible notices: the GENERALISE_CUT message in the map, the export refusal text, and the out-of-range notices. Attach before and after screenshots for changed existing UI, or after-onl…
Passed checks: 3 passed
Check name
Status
Explanation
Title check
The title names the main change: a generalisation pad read in place is cut to what fits at the view's level and reported, and out-of-range generalize values in a file are set and reported. It matches …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: a generalisation pad read in place is cut to what fits at the view's level and reported, and out-of-range generalize values in a file are set and reported. It matches the raster.rs, render raster.rs, and fixture changes. The title is long (155 characters) and dense, but it is related to the changeset and specific.
Full details: Description check
Explanation
The description follows the template's main purpose and fills in the Summary and Testing sections in substance. It explains what changed and why: a GeoTIFF read in place now caps the generalisation pad rather than dropping to a coarser level, and out-of-range generalize values in files are clamped and reported. It also gives test names, the commands run, and the known unrelated Windows test failure. The UI evidence section is not addressed. The author gives no 'No visible UI change' line and no screenshots. Yet the PR changes the messages and notices that appear in the map and export dialogs, so the UI evidence section needs a decision. The Related issue section is also blank: the description says 'Part of #3145' and 'Follows #3434', but the template's Related issue line is not filled in the expected format.
Resolution
Fill in the 'UI evidence' section. The PR adds new user-visible notices: the GENERALISE_CUT message in the map, the export refusal text, and the out-of-range notices. Attach before and after screenshots for changed existing UI, or after-only screenshots for new UI. If the author decides no UI change is visible, replace the placeholder with the 'No visible UI change.' line. Also restate the link in the 'Related issue' section as 'Part of #3145' so the template format is followed.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks the map at dawn, And trims the values past their bounds. The raster finds a fitting pad, With softer reach near view edges. The layers speak when values change, Then hop along beneath the moon.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: 2b98c33f-0dcf-47ac-bdaa-a6fc2bd1310c
Commits
Reviewing files that changed from the base of the PR and between 1a51888 and 7d0c065.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.
No bugs or security issues found. The new notice and the cut-pad path look correct on reading, and the existing reader paths are covered (details below). Three inline comments were posted, plus a few nits in the summary.
Bugs: none found.
Security: none found.
Performance
The pad search in crates/render/src/raster.rs (around line 273) runs on every redraw that hits the cut case. Each probe calls fits → chunks_of, which builds a HashSet over all tiles in the window. About 15 probes run per strip per frame while zoomed in, and part(fits) recomputes the window the search already found. Confidence: medium, not timed. (Inline comment posted.)
Quality
The out-of-range test's notice assertions (contains("2 "), contains("dem")) are too loose to catch a wrong message. Suggested exact-text checks are in the inline comment at crates/engine/src/tests.rs:8270. Confidence: high.
Doc comments and constant docs cite review threads (#3434 review). These will go stale; leave them for the release quality pass. Confidence: high.
The multi-layer notice lists every affected layer with no cap, so a project with many hand-edited layers gets a long notice. Acceptable as is. Confidence: low.
AGENTS.md
The change alters how a project and layer file are read, so AGENTS.md asks for a fixture in schema/fixtures/. The new test reads the existing in-range fixture and sets the bad values in memory, so no file with an out-of-range generalize is read. The schema doesn't bound generalize, so a fixture would pass check-jsonschema. Confidence: medium, since the rule may be read as covering only saved-format changes. (Inline comment posted.)
Twins checked
Layer-file adds (layer.addLayerFile, .rgislyr by path via add_layer_text_within, and group files) all reach settle_added. layer.addDataText does not read layer files.
Project opens (project.open, openText, new, sample, and peer text via reset_to) all reach reset, which calls the new notice.
map.import goes through import_maps, which calls the new notice.
project.importQgis and project.importGeolibre do not call say_block_layers either. QGIS raster import sets generalize to 0, so the omission is harmless.
style.import drops raster layers before taking styles, so it can't carry a relief generalize.
Export and map both reach the cut case through draw_in_place. No wasm32 branch changed.
Prior reviews: the thread list was empty, so no earlier concerns were left alone.
Change size
Compared: the whole PR against main (merge base 37f8a16 to PR head 98b5225).
The reason will be displayed to describe this comment to others. Learn more.
Additional comments: 1
crates/engine/src/tests.rs-35645-35645: 1
35645-35645: <[REDACTED]icture></[REDACTED]icture> Minor · [REDACTED]tability & Availability · Quic[REDACTED] win
<[REDACTED]icture></[REDACTED]icture> Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Use an automatically cleaned tem[REDACTED]orary directory.
If an assertion fails after the first successful e[REDACTED]ort, the test [REDACTED]anics before Line 35653 and leaves the PNG behind. [REDACTED]he PID-based filename also does not guarantee e[REDACTED]clusive creation.
Create a unique tem[REDACTED]orary directory with automatic cleanu[REDACTED]. Kee[REDACTED] both e[REDACTED]orts [REDACTED]ointed at the same file inside that directory.
Based on learnings, filesystem tests must use an acce[REDACTED]ted isolation method, such as “isolated tem[REDACTED]orary directories with cleanu[REDACTED].”
[REDACTED]ource: Learnings
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: ASSERTIVE
Plan: Advanced
Run ID: cc882837-7cf0-418c-b018-d8d0b3ceb390
Commits
Reviewing files that changed from the base of the PR and between 35aae11 and 98b5225.
Files selected for processing: 6
crates/engine/src/cmd/items.rs
crates/engine/src/cmd/layer.rs
crates/engine/src/cmd/project.rs
crates/engine/src/cmd/raster.rs
crates/engine/src/tests.rs
crates/render/src/raster.rs
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).
I read the diff, the staged AGENTS.md, and the earlier review threads, then traced the changed render and engine paths and their callers. The cut logic in draw_in_place checks out: the binary search keeps fits passing and over failing, cut is set only at the needed level, and the non-cut path is unchanged. The least/pad refactor keeps the old behaviour. Nothing here is a crash or a security issue.
Bugs
style.import (import_styles, cmd/items.rs) gives existing layers their renderers from a file with no check, so an out-of-range Shaded Relief generalize is kept as written and not said. The draw path clamps it, so the picture is right, but the saved value differs from what is drawn. Confidence: medium. Posted inline.
offline.open pushes a map from an offline area's saved snapshot, and reset doesn't walk those snapshots, so an out-of-range value there goes unsaid on both open and offline.open. Confidence: medium-low. Posted inline.
Security
None found.
Performance
Left alone: the per-redraw search cost in draw_in_place is already raised in a prior thread, and the code it points at is unchanged.
Quality
None beyond the item below.
AGENTS.md
The new notice names layers but not maps. The project-wide and import calls span several maps, so two dem layers can't be told apart. say_block_layers names the map, and AGENTS.md asks for "what, how much and where". Confidence: medium-high. Posted inline with a suggestion.
Already raised, left alone: 3 earlier concerns. These are the loose notice assertion in tests.rs, the missing out-of-range fixture (agents-md), and the per-redraw search cost. None of them has an answer in the threads.
Change size
Compared with the base branch: the whole PR against main (merge base 689a25c to PR head e802dd9).
… written (opengeos#3145)
From review: the fixture schema/fixtures/shaded_relief_generalize_out_of_range.rgis
holds 1e20 and -5, and the test that sets and says them reads it as
written, rather than setting the values in memory.
Part of opengeos#3145.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
I read the full diff, the staged PR metadata and prior review threads, and the surrounding code for each changed path. I posted one inline nit (crates/engine/src/cmd/raster.rs:1188). No new bugs, security issues or AGENTS.md breaks found.
Bugs
None new.
Already raised and still applicable, no author answer: workspace.rs:433 (offline.open) pushes a snapshot map without say_generalize_out_of_range, so an out-of-range value there is drawn clamped, saved as written and not said. Confirmed unchanged in this PR. Confidence: medium-high.
Already raised, which I disagree with: the items.rs:690 thread says style.import is an uncovered twin. import_styles drops raster layers before building its items (items.rs:796, filter(|l| !l.is_raster() …)), and Shaded Relief lives only in raster layers, so a style file cannot carry generalize. That thread can be dismissed.
Security
None found. The new code only clamps values and adds notices. The new fixture is local and has no paths or secrets.
Performance
None new. The halving search in raster.rs:271–281 runs on the draw path each frame that hits the cut, and it recomputes part(fits). Both points are already raised, and the author agreed to defer them. Confidence: medium.
Quality
Posted inline (raster.rs:1188): the per-layer name clone. Nit.
Not raised before: the group-file add path (group_file.rs:94) calls settle_added but has no test. The notice path is shared, so the gap is small. Confidence: high.
Already raised: the loose notice assertions in tests.rs (~8262). The author deferred them to the quality pass.
AGENTS.md
None new.
Already raised, unanswered: the notice at raster.rs:1193 names layers but not the map. Two maps can each hold a layer dem, so the notice is ambiguous when several maps are in range. This is a "where" gap under "Never silent". Confidence: medium.
Already raised and resolved: the fixture requirement. schema/fixtures/shaded_relief_generalize_out_of_range.rgis is now in place.
Twins checked
Layer-file add (layer.addLayerFile) and group-file add: both reach settle_added. The layer-file add is tested.
Map import (map.import): covered and tested.
Project open (project.open, via reset): covered and tested.
Style import: not reachable, see Bugs.
Offline open: not covered, see Bugs.
Field bring-back (field.rs:1493) and QGIS import (qgis.rs:2418): not traced to a point where a Shaded Relief generalize would be read. Low risk.
Render: the export path shares draw_in_place, so the new refusal reaches exports. No #[cfg(target_arch = "wasm32")] branch changed.
Prior concerns
Six threads already exist on this PR. I left all six alone; none of their code changed, and I did not repeat them.
Change size
Compared: the whole PR against main (merge base 689a25c to PR head 1a51888).
…hen its generalisation is out of range, and the notice names each layer's map (opengeos#3145)
From review:
- offline.open builds a map from an offline area's snapshot, which a
project's read doesn't check: a generalize out of range in it is now
set and said as its map opens.
- The notice names each layer's map, as two maps can hold layers of
one name.
- The out-of-range fixture ends with a newline (end-of-file-fixer).
Part of opengeos#3145.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reviewed the whole diff (8 files: the generalisation clamp on project open, map import, layer-file add and offline open; the render change that cuts a relief's pad at the needed level; and tests and a new fixture). I found no confirmed bugs, security issues or new performance problems. The one inline comment is below.
Bugs
None confirmed. I checked the render cut logic: the binary search keeps fits < over, over - fits cannot underflow, padded clamps so fit is monotone, and cut only applies at level == needed, so the GENERALISE_CUT arm is reached only for that case. Confidence: high.
Security
None found.
Performance
Nothing new. The per-probe fits cost (the HashSet over tiles on each halving probe) was already raised in the prior threads, and the author deferred it. I left it alone.
Quality
Inline: an offline area's stored snapshot keeps an out-of-range generalize as written, so a file saved before the area is opened still holds the raw value. The PR body's "saved again, the file holds what is drawn" doesn't cover this. Confidence: medium-low.
The notice lists every affected layer in one string (set.join(", ")), so a hostile file with thousands of such layers produces a very long notice. Confidence: low. Possible fix: cap the listed names and keep the count.
The PR body still describes the old notice text (dem (25000 m, now 10000 m): its Shaded Relief's…). The code now says dem in Map (…). Confidence: high.
AGENTS.md
The PR body doesn't say which surfaces the change reaches (desktop, browser, CLI, Python, phone, ribbon, Assistant/MCP, undo), and why the rest don't apply. The "Reach every surface" rule asks for that statement. Confidence: medium, since the rule may be read as applying only to code.
Twins checked
Layer add routes:layer.addLayerFile and group files both reach settle_added (group_file.rs:94). layer.addData* and the service routes create raster or service layers without a file-supplied generalize, so they don't need the check.
Project open routes:reset covers project.open/openText and the peer path (peer.rs:522 calls reset_to). project.importQgis and project.importGeolibre don't set a Shaded Relief generalize, so they don't need it.
Map routes:map.import and offline.open are covered. map.new, the publication globe and the circle-edit copy build maps in code, not from files.
style.import: confirmed in items.rs:796 that it keeps only non-raster layers, so a raster's generalize never reaches a layer from a style file. The author's answer holds.
Wasm: no cfg(target_arch) branch is changed.
Prior threads
I left 7 earlier bot concerns alone, because the author addressed or answered them and I checked the code. They cover the offline gap, the style.import twin, the fixture, the notice's map name, the loose notice assertion, the l.name.clone() nit and the fits performance. The clone nit and the fits cost are still in the code and were deferred by the author.
Change size
Compared: the whole PR against main (merge base 689a25c to PR head 7d0c065).
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
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.
Part of #3145. Follows #3434 (part 2), whose review asked for two things after it: a cap on the read-in-place pad of a generalised relief, with what is drawn said, and a notice for a
generalizeout of range in a file.A GeoTIFF read in place: the pad is cut, not the resolution
Since #3434 a part read in place is padded by the generalisation's reach, about three Gaussians in the level's pixels. When that pad makes the part more than the tiles kept can hold at the level the view needs, the read moved to a coarser level, and the map and exports said "the view is too large a part of the image to read at the resolution it needs", which is not why. #3434's body measured it: a 1920 × 1080 view of a 1 m DEM at 10 km has a pad of about 30 000 pixels and was read from level 4, 16 times coarser.
Now, at the level the view needs, the pad is cut to the largest that fits (a halving search between the pad without the generalisation and the full one), so the view keeps its resolution. Near the view's edges the smoothing then reads fewer cells than its reach. That is drawn and said, as any part drawn from less than it needs is: the map shows it and says its generalisation reaches farther past the view than can be read at the resolution it needs, so near the view's edges it is smoothed from fewer cells: a smaller generalisation or a smaller view draws it whole; an export refuses it with that reason. When even the pad without the generalisation doesn't fit, the read moves to a coarser level as before, with its own reason.
At the sizes the issue works with (60–120 m on 30 m cells) the pad is 7–13 pixels and nothing changes.
A
generalizeout of range in a fileraster.symbologytakes 0 to 10 km; a file written by hand can hold anything, and #3434 drew it as the nearest (past 10 km, 10 km; below 0 or not a number, none) without a word. Now, as a project opens, as maps are imported, as a layer file (or group file) is added and as an offline area's map opens (its snapshot isn't checked when the project is read), such a value is set to what is drawn and said, with the layers, their maps and how many: dem in Map (25000 m, now 10000 m): its Shaded Relief's generalisation was outside 0 to 10000 m, so it is set to the nearest it can be. A style file takes no raster's style, so none reaches a layer fromstyle.import(tested). Saved again, the file holds what is drawn, for the project's maps. An offline area's stored snapshot is set and said when its map opens, and the snapshot itself stays as written until then (the map opened from it holds the value drawn).Tests
Each written first, failing before its change:
a_generalisation_reaching_past_what_fits_is_cut_at_the_level_needed_and_said(engine): a 4096-pixel GeoTIFF of three bands stored together, served by ranges, exported at 768 pixels a side at the resolution of its full level. At 1 km it is written; at 10 km the export is refused by its generalisation, not as a view too large (it was refused as a view too large before, read from a coarser level).a_generalisation_out_of_range_in_a_file_is_set_within_it_and_said(engine): the fixtureschema/fixtures/shaded_relief_generalize_out_of_range.rgis(1e20 and −5, as written by hand) opens with 10 km and none, said once with each layer and its map; a map imported with 1e20, a layer file added with −5 and an offline area's map opened with 1e20 are set and said too; a style file's import takes none; a project in range says nothing.cargo fmt,clippy -D warnings(render, engine, all targets),cargo xtask schema --checkandcargo xtask commands(unchanged) pass. render 1113 and engine lib 3042 pass; the engine integration testportable_projects::reload::wrong_geometry_missing_file_and_missing_chosen_table_leave_the_layer_unchangedfails locally on Windows on main too and doesn't touch rasters.No
i18nchange.Size: 198 changed lines (+186 −12), about 110 of them tests; it grew from 167 in review.
🤖 Generated with Claude Code
Summary by CodeRabbit