Repository navigation
Description
Before you start
- I searched the existing issues and the roadmap and did not find a duplicate request. Never hold the window: UI-thread reads and cancellation test fidelity (2026-11 sweep) #2641 lists other commands that hold the window;
raster.mosaicisn't among them. [Feature]:raster.mosaicmatches each input to the one above it in their overlap, and can feather the seam #2595 (mine) asks for what the mosaic does with its seams, not for where it runs.
What problem does this solve?
raster.mosaic joins tiles of one grid. Its work grows with the tiles, and it has no background path: it is in neither workflows::IN_BACKGROUND nor ON_A_COPY, and its doc comment doesn't say why. Whoever asks for it holds the window, without progress or Cancel. raster.process, raster.rasterize and imagery.mosaic (the mapping workspaces' Build) have a path.
Times of the same raster_mosaic in the 0.8.0 release, from the command line (i7-10700, Float32):
| Inputs | Time |
|---|---|
| 2 tiles, 120 million cells, from layers | 1.0–1.2 s |
| The same, from GeoTIFF files | 1.9 s |
| The same, from files, also writing the GeoTIFF | 2.8 s |
| 2 tiles, 480 million cells, from files, also writing the GeoTIFF | 9.9 s |
| 20 files of 60 million cells over the same area | 11.1 s |
The result is at most max_samples() values (120 million to 1 billion, by memory). The total read isn't bounded when the inputs overlap, up to 10,000 of them.
It comes from the review of #2826, which takes the command off the Imagery extension, so it is reachable with the app's defaults.
Proposed solution
Registering the command isn't enough on its own. Since #2739 the app starts every IN_BACKGROUND command on a thread when it comes through the app's dispatch, but nothing there asks for raster.mosaic: it has no pane, and Command Search says it needs input. Today's callers (a script, a task, the Assistant, an attached agent, a plugin) run on the session, where every raster command still runs in place. So, two parts:
1. The path. ("raster.mosaic", "Mosaic Rasters", mosaic_rasters_work) in workflows::IN_BACKGROUND:
- The session is read first, on the UI thread: the layers (an
Arceach, no copy), the names and the output path, with the permission and the checks as now. - On the thread: the files are read, checked and copied into the result. Cancel is looked at between inputs and between blocks of rows, and progress counts the inputs' rows.
- The GeoTIFF is written staged and put in place as the raster is added, as Polygons to Raster does (Polygons to Raster on a thread of its own, and raster commands from the app's dispatch too #2739).
- Notices (what reading left out, copyrights, band names) are said as it lands, in today's order.
raster.mosaicgoes inlong_commands.- The answer, parameters, results and errors don't change. Command line, Python and MCP run it in place, as now.
2. A caller. A Mosaic section in the Workflows pane: the rasters to join, in order (the first wins where they overlap), a name, and a GeoTIFF to write or none. It runs through the dispatch, with its progress and Cancel in the pane. It is listed in the Workflows menu and has no ribbon button.
Part 2 lands after part 1. No dependency is needed.
Left out: raster commands a script, the Assistant, an agent or a plugin runs on the session. That holds for every one of them and needs a design of its own. Also raster.project, which has no path either, and reading the files one at a time to hold fewer in memory.
Estimated scope
Medium: two pull requests of about 300 lines each, tests included. I can open them, after #2826 lands.
Alternatives considered
- Only part 1: it follows the rule, but nothing in the app would use it yet.
- A line in Never hold the window: UI-thread reads and cancellation test fidelity (2026-11 sweep) #2641 instead of this issue: that list is of reads found in a sweep; this one also needs a pane.
- GeoLibre's Mosaic tool runs in the background with Cancel where GeoLibre is installed, but it resamples and blends, so its cells aren't the inputs'.
Not measured: the window itself. The times are the command's, and that it runs on the UI thread is from the code.
Activity
feat(raster): Mosaic Rasters on a thread of its own, with Cancel (ope…
fix(workflows): another project opening empties the Mosaic list of it…
fix(workflows): the Mosaic list offers a name two layers share once, …
fix(workflows): the Mosaic list follows the map shown, and leaves out…
fix(workflows): the Mosaic list knows its map by name, and waits whil…
feat(workflows): a Mosaic Rasters section that runs raster.mosaic on …