Repository navigation
feat(embeddings): a point layer as the reference of embeddings.similarity (#1720) - #2797
Conversation
…rity (opengeos#1720) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewScope: 2 files, Bugs
Security
Performance
Quality
AGENTS.md
I checked 2 concerns, 0 of them repeated from earlier threads. Change sizeCompared with the base branch: merge base dd3d011 to PR head 703d266.
|
📖 Docs previewCommit |
…w waits Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Code reviewReviewed the diff against Bugs: No new bugs found. One earlier concern still applies and is not re-posted: Security: None found. The layer reference goes through Performance: The point-layer scan runs on the assistant's frame with no Cancel. This was raised earlier and answered in the PR (the Quality (nits, grouped, not posted inline):
AGENTS.md:
No inline comments were posted. The earlier threads on this PR: 2 concerns left alone (the UI-thread scan, which the author answered, and the out-of-range index miscount, which is still present). Change sizeCompared: the whole PR against main (merge base dd3d011 to PR head 73d0e05).
|
Code reviewReviewed PR #2797 ( Bugs
Security
Performance
Quality
AGENTS.md
Change sizeCompared with the base branch (merge base dd3d011 to PR head 73d0e05).
|
Part of #1720: the leftover of §3.2 that #1876 listed under "Not in this PR", a reference from a point layer.
What it does
embeddings.similarity's"points"takes a point layer's name or id, besides the list of[lon, lat]it takes today. The reference is the mean of the unit embeddings at the layer's points, as for the list.Layer::resolve_rowswithPolicy::SelectionAndQuery, as geoprocessing tools take a layer (docs/user-guide/analysis.md). The time slider and display filters don't apply, as for tools.Dataset::lonlat_conversion).points(those used, as today) and, for a layer,reference: the layer, how many features gave points, and whether a selection (selected) or a definition query (filtered) was applied. They say it was applied, not that it left features out, which the notice says with its counts.similarity_work. Filtering, converting and counting run in the work, before anything is asked of the network, so Cancel and a project change while it runs behave as today.Never silent
Each is one notice with a count (or an error), and a layer whose every feature is taken says nothing:
reference points taken from 1 of its 4 features (its selection));Errors, before any request: an unknown layer; a raster, line or polygon layer or a table (with its name and kind); a layer read in place without a selection; an empty layer; a definition query that hides every feature; no usable point (with what was left out); more than 1000 points (the scan ends at the first one past it, so the error doesn't count the rest). A reference with no embedding in the area also says what its layer left out.
Choices
raster.rasterizeand a grid's extent layer do. Reading the whole source for at most 1000 points didn't seem worth it, and refusing keeps the command's permissions as they are.bbox: a layer doesn't change it.pointsis a layer's id, and a string a name, else an id (Session::layer_id), as"layer"is elsewhere..inputs(…), so a layer named inpointsis bound and shown when the assistant asks; a list binds no layer.command-surface.txtis unchanged.Surfaces
Command line, Python, the assistant and MCP (the parameters' help text), and scripts and models take the new form, as they take the command. The web app and a plugin's command in the app are refused as before. No button exists for the command yet, so there is none to change. The raster is undone as before.
Memory, worked out from the types (not a run of
cargo xtask memory, which has no scenario of this command), for a layer whose rows take 64 bytes each plus 24 per field (the sizes ofFeatureandValue; text and a multipoint's places on top):resolve_rowsanswersRows::All);resolve_rowsholds 8 bytes for each kept row during the scan (up to 24 while that list grows): 0.03× of a layer of 10 fields (0.08× while it grows), and 0.13× (0.38×) of one with no field, the most it can be;Each is freed when the points have been taken, before anything is asked of the network.
Tests
a_point_layers_reference_is_its_points_lists: a point and a multipoint, in longitude/latitude and held in UTM 32N, named by name, id and id as text: the list's points to 1e-8° and the same reference; nothing said; what exact approval binds.a_point_layers_selection_and_definition_query_are_its_reference: each alone and together, a feature selected twice, a query that hides none, all, or can't be read.a_point_layer_says_what_its_reference_leaves_out: missing and empty geometry, a line, places out of range; all left out; an empty layer; at the limit and over it.a_reference_layer_that_isnt_one_is_refused: line and raster layers, an unknown name and id, other JSON; a layer read in place, with and without a selection.Locally (Windows):
cargo fmt --check;cargo clippy -p rustgis-engine --all-targets -- -D warnings;cargo xtask layers,test-hygieneandrows.cargo test -p rustgis-engine, after the review round: all pass but four that this change doesn't touch:cog_windows_stand_in_the_level_kept_until_their_tiles_arrive(failed in this full run, passed in the previous one and three times alone),gdal_formats_open_when_gdal_is_installedandfiles_gdal_reads_are_held_in_their_own_system(this PC's GDAL is 3.7.1; 3.8 is needed) andreload::wrong_geometry_missing_file_and_missing_chosen_table_leave_the_layer_unchanged, which already failed here on main at #1876.By hand with the branch's
rustgis-cliat Viçosa (MG, Brazil), box[-42.91,-20.78,-42.85,-20.735], 2024, a layer of a point, a multipoint of two, a point outside the box and a feature without geometry. The exported GeoTIFFs are byte-identical for the list of the four points, the layer in longitude/latitude (GeoJSON) and the layer in UTM 23S (GeoPackage, EPSG:32723); and for the multipoint selected and the list of its two points.Searching AlphaEarth needed #2807 (since #1894 every search found no tiles, on main and in 0.8.0), which is now in main. Those runs were made with a local one-line change in its place; they were made again, without it, on a local merge of this branch (73d0e05) and main (132a81c, with #2807), which merges without conflict:
embeddings.searchfinds the box's 2 tiles, and the five GeoTIFFs are byte-identical to the first ones. On that mergecargo test -p rustgis-enginepasses but for four: the two GDAL tests and thereloadone above, andcloud_optimised_geotiffs_are_read_in_place, which this change doesn't touch and which passed three times alone.Not tested: the desktop app's window, a layer read in place from a real source (the test sets one on a layer in memory), and the wasm build on this PC (CI's job covers it).
🤖 Generated with Claude Code
Summary by CodeRabbit