Repository navigation
Use the visible raster layer name for workflow outputs - #3542
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
| let src = raster_of(s, ps(p, "layer").ok_or("layer is required")?)?; | ||
| let target = resample_target(s, p)?; | ||
| let name = out_name(p, format!("{}_{}", src.held().name, ps(p, "function").unwrap_or("")))?; | ||
| let name = out_name(p, format!("{}_{}", src.layer_name, ps(p, "function").unwrap_or("")))?; |
There was a problem hiding this comment.
The output name now comes from the visible layer name here, but the same default is still built from the raster's internal name in other raster commands. After a rename, a DEM loaded from exportImage.tif still yields exportImage_… in them. Examples I checked by grep: index_work (imagery.rs:1667, format!("{}_{idx}", r.held().name)), and imagery.rs:197, 1311, 1551, 1731, 1854, 1886 and deeplearning.rs:307, 348. All read their input through Input::of, so the layer_name field would be available to them.
The PR body limits the fix to Visibility Analysis, raster functions and chains, but the title says "workflow outputs". Either extend the change to these, or say in the PR body why they stay as they are. The new test covers only the three commands in this diff.
Category: quality
| }; | ||
| let name = out_name(p, format!("{}_viewshed", dem.held().name))?; | ||
| let dem_name = dem.held().name.clone(); | ||
| let name = out_name(p, format!("{}_viewshed", dem.layer_name))?; |
There was a problem hiding this comment.
The default name is built with format! and is not checked against the 200-character limit that out_name applies to a name the user gives (#1888). A layer name at that limit gives a default up to 209 characters long, since _viewshed adds 9. function_work and function_chain_work have the same pattern. This is probably harmless, because in_blocks shortens file stems, but it is inconsistent with the cap. I did not confirm whether renaming a layer enforces the same 200-character cap, so my confidence is low.
Category: quality
Code reviewI found no bugs, security issues or performance problems. Two quality points are posted inline. I checked the diff against the surrounding code in Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared: the whole PR against main (merge base def6c67 to PR head 9e52e7d).
|
📖 Docs previewCommit |
Summary
Use the input layer’s name in Contents when generating output names for Visibility Analysis, raster functions, and raster function chains. For example, a DEM downloaded as
exportImage.tifand namedMDT Bogotá 2025now producesMDT Bogotá 2025_viewshed. An explicit output name still takes precedence.The shared engine captures the visible layer name when resolving the input, so callers get the same behavior and function chains use the same name whether they process the raster in memory or in blocks. Codex assisted with implementation, testing, and this description.
Testing
Tested on Apple Silicon with macOS 26.6.2.
cargo test --locked -p rustgis-engine --lib raster_workflow_outputs_use_the_visible_layer_namepassed. It checks the generated and explicit names for each of the three commands on a renamed DEM, including a case-insensitive layer lookup.cargo xtask cistopped at the renderer testpolygon_labels_tests::with_both_places_inside_taken_it_goes_round_its_polygon_corners_first. Rerunning that test on the unmodified base commitdef6c67fproduced the identical assertion failure at 0° rotation and 30° tilt.UI evidence
The same named DEM and observer position are used in both runs. The output layer appears in Contents.
Before
After
Related issue
Closes #3488
Summary by CodeRabbit