Repository navigation
Description
Before you start
- I searched the existing issues and the roadmap and did not find a duplicate request.
What problem does this solve?
#1210 (for #1204) reads a window of a cloud-optimised GeoTIFF as a raster layer: layer.addUrl with "bbox". The read blocks where the command runs. It waits up to two minutes for the header, then up to two minutes for each band, and no band is started after five minutes. On the command line and in scripts that is what a caller expects.
In the desktop app, the command palette's layer.addUrl runs as ui.addUrl. Its probe runs off the frame. poll_data_downloads then runs layer.addUrl with the caller's parameters on the frame, so the window read holds the UI while it waits. On a slow server or a large window, that can be minutes. A plugin's command (leave_downloads) can't take that wait at all, so #1210 refuses "bbox" there with a message. That leaves out BrasilData's MapBiomas windows, the case #1204 was opened for.
Proposed solution
Split the window read from adding the layer, so the slow part can run on a worker and the layer is added on the frame when it lands. That is how ui.addUrl already handles a whole download.
- Engine:
add_cog_windowbecomes two steps:read_cog_window(url, params) -> Result<Window, String>: the box, the level, the header and the bands' values, with the notices to say and noSession. It can run on any thread, since everything in it already calls blockingrustgis_tiles::cogfunctions.add_window(s, Window): builds the raster, keeps it in the project and says the notices, as the command does now.
layer.addUrl {"bbox"}on the command line runs both in turn, as today.
- App:
ui.addUrlwith"bbox"startsread_cog_windowon a worker, beside the probe it starts now (cog_probes). It shows the read as running, the way a download shows, andpoll_data_downloadscallsadd_windowwhen the result lands. An error is said there too. - Plugins: with
leave_downloads,layer.addUrl {"bbox"}goes to the same queue (request_url) instead of being refused, and the plugin command runs again when it lands, once [Feature]: A plugin command that downloads a layer runs again when it lands, so it can go on with it (clip, rename, style) in the web app and, after #1170, on the desktop #1202 is in.
Choices in this proposal
- Split the command, not a thread inside it.
Sessionstays on the frame. Only the read, which needs no session, moves. - The same limits as now. The value and band caps and the five-minute overall wait still apply on the worker, so a hostile or huge file can't keep a worker forever.
- Cancelling a running window read: a follow-up. The first step only stops it from holding the UI.
Estimated scope
crates/engine/src/cmd/layer.rs: the split, and the plugin path no longer refused.crates/ui-egui/src/lib.rs: the queue entry and its landing.- Tests: the engine's window tests run on the split as they are. A UI test checks that the frame isn't held: a slow test server, the frame keeps drawing, and the layer is added once the read lands.
Alternatives considered
- Refusing
"bbox"inui.addUrl. It would leave windows to scripts and the command line only, and the command palette mapslayer.addUrltoui.addUrl. - Running the whole command on a worker with a cloned
Session. The clone would be heavy, and two sessions would have to be merged when it lands.
🤖 Generated with Claude Code
Activity
fix(raster): a window on the frame waits for no other; windows waitin…
fix(raster): a window read off the frame refuses GeoLibre's download …
fix(raster): a window waiting when its project closes isn't read; one…
fix(raster): say a window given up without blaming the project; name …
fix(raster): a window refuses what it doesn't read of a service; no d…
test(raster): match the refusal of a local path by the part redaction…
fix(raster): a window refuses "cube": true; a read whose thread doesn…
feat(raster): read a COG window off the frame in the app (#1330, part…
test(plugins): a plugin command runs again and answers the window add…
fix(plugins): a window asked for the view keeps the view it was asked…
fix(plugins): keep the view's box beside a window request, not in it (o…
fix(plugins): a window of the view joins only one asked in the same v…
fix(plugins): view boxes travel with the waits; join check inside the…
fix(plugins): keep the view boxes of live waits when no command waits (…
docs(plugins): a script or model the app runs leaves a window to it t…
fix(plugins): a command run again gets each view's own window (openge…
docs(plugins): UrlWaits keeps its doc comment, above VIEW_ASKED (open…
fix(plugins): a caller's own "viewAsked" is left out of what it asked…
test(plugins): a window of the view being read joins only the same vi…
feat(plugins): a plugin command's `layer.addUrl` with "bbox" goes to …