Repository navigation
fix(engine): give a tool a layer's pixels, keep a turned GeoPDF's layers within the page's samples (#3442 part 5a) - #3584
Conversation
…ers within the page's samples (opengeos#3442 part 5a) A raster layer with a subdataset (a PDF layer or page, a NetCDF variable) reaches a geoprocessing tool as its pixels, not as its whole file. Each layer of a turned GeoPDF is turned within its share of the samples. The layers are drawn from one copy of the file whose update is rewritten, and a shared embedded file is read back from the first layer of its id. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewBugs
Security
Performance
Quality
AGENTS.md
Checked, no finding
Prior concerns: none; no prior review threads existed, so nothing was left alone. Change sizeCompared with the base branch: the whole PR against main (merge base c89014f to PR head c9d31c3).
|
📖 Docs preview
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 |
Two layers with one id (a project edited by hand or corrupted) can't be told apart when read, so a file of theirs is written whole and a layer sharing it gets the right file in either order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewBugsNone found. I checked:
Confidence: high. SecurityNone found. PerformanceNothing beyond the copy lifetime noted under AGENTS.md below. Quality
AGENTS.md
Prior reviewsI left 2 earlier concerns alone, both already answered: the size-multiple disclosure on Not run: I had no shell, so nothing was built or tested. Change sizeCompared with the base branch: the whole PR against main (merge base c89014f to PR head 467546f).
|
Part of #3442 (part 5a of 5).
Points left from the reviews of parts 2 to 4, each with a test written first.
A tool reads the layer, not its whole file (T25)
A raster layer that is part of its file reached a geoprocessing tool as the file: the path on disk or the embedded bytes. A suite tool then read the file whole: a PDF layer gave the tool the whole of page 1, and a PDF opened at page 2 gave it page 1 too.
MapInputs::rasternow gives such a layer's pixels instead: no path and no embedded file when the layer has a subdataset. This is not limited to PDFs. It covers any layer with a subdataset: a PDF's layer or page, a NetCDF or HDF variable read through GDAL, a Zarr slice. Each of those reaches a suite tool as a GeoTIFF of its pixels, as a layer with no file already does. A layer that is a whole file is still given as the file.Test:
a_layer_that_is_part_of_its_file_reaches_a_tool_as_its_pixels, covering PDF layers and pages from a file and from an upload, and a NetCDF variable.A turned GeoPDF's layers stay within the page's samples (T19)
A GeoPDF whose map is turned on the page is placed north up by
placed_by_world_file, which turns it within all ofmax_samples(). The page's layers are drawn in shares of those samples, but each was turned within all of them. A 45° turn spreads a layer over about twice its area, so the layers together could take about twice what a page may hold.Raster::placed_by_world_file_withintakes the limit. Each PDF layer is turned within its share, and a page read as one picture within the limit it was drawn in.Test:
layers_of_a_turned_page_are_turned_within_the_samples_a_page_has. Without the fix, the layers take 53,824 samples of 30,000.One copy of the file for all the drawings (T17)
Each layer is drawn from a copy of the PDF whose catalog an update at its end rewrites, and every drawing copied the whole file again: about 65 copies of a 64-layer PDF.
with_onlynow rewrites only the update at the end of one copy, kept between drawings. The copy is reserved withtry_reserve_exact, so an allocator refusal becomes an error; it is not counted by the memory planner (memory::planned), as the copies before were not.Test:
each_drawing_rewrites_the_update_at_the_end_of_one_copy.memory::plannedis a change of its own, left for later.pdffeature is on: the desktop app, the CLI and its MCP server, and the Python package. The web app and mobile don't read PDFs, so they aren't reached.with_onlyreturnsbytes.to_vec()with the update, anddraw_withdrops its keptcopy.Smaller fixes
embedded_samestill names a layer by its id, so projects saved before open as they did. Test:a_shared_file_is_read_back_though_two_layers_have_one_id, in both orders.map(take).last().Tests
Local runs on the touched crates (map, data with
pdf, engine), with fmt and clippy-D warnings, all pass, exceptportable_projects::reload::wrong_geometry_missing_file_and_missing_chosen_table_leave_the_layer_unchanged, which fails the same way onmainon this machine.cloud_optimised_geotiffs_are_read_in_placefailed once under the full parallel run and passed on its own and on the next full run.Next
/OCGs(T20), content of several groups shown only when all are on (/P /AllOn, T16), and a group whose content lies both inside and outside an off parent (T8).🤖 Generated with Claude Code