Skip to content

Edits, paste, topology and offline sync with a feature that has no longitude/latitude place (#2032 C2f-4b-1c) - #2842

Merged
pick2510 merged 3 commits into
opengeos:mainfrom
pick2510:crs-unplaced-edits
Nov 24, 2026
Merged

pick2510 merged 3 commits into
opengeos:mainfrom
pick2510:crs-unplaced-edits

Conversation

@pick2510

@pick2510 pick2510 commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Part of #2032 C2f-4b-1, after #2778 (C2f-4b-1a) and #2798 (C2f-4b-1b). A layer held in its own system can have a feature with a place that can't be given in longitude/latitude: one far past where its system reaches. This PR covers edits, paste, topology and offline sync.

Before: one such feature in the selection, the layer or the source failed the whole edit, check or sync.
Now: an edit of many features leaves it as it is and says how many; an edit of that one feature is refused naming it. A layer whose places all convert says nothing new, so its results are unchanged.

  • Edits of the selection:
    • Move, Rotate, Scale, Split and Cut Polygon leave such a feature as it is. One notice counts them by layer: "n feature(s) of 'a' (k), 'b' (m) have a place that can't be given in longitude/latitude, so they were left as they were".
    • When the selection holds only such features, the edit is refused, saying why.
    • Flip Line only reorders vertices, so it now works in the layer's own coordinates and flips such a line too.
  • Edits of one feature (a vertex, Reshape, Trace, Merge with it, a shape conversion): refused as before, but the message now names the layer and the feature. The new Dataset::feature_to_lonlat gives "{layer}: feature {id} has a place in {system} that can't be given in longitude/latitude, so it can't be edited there". Set Geometry and Delete still work on it, so it can be given a new shape or removed.
  • Paste into a layer of another system: a feature with a place that layer can't hold is left out, and a notice counts it. All conversions now happen before the layer changes, so a refused paste into a graphics layer no longer leaves a new field behind.
  • Topology (topology.validate):
    • Rules checked in longitude/latitude (a layer in Web Mercator, a world projection or a geographic system): such a feature is left out of the check, and a notice names the rules and counts the features. The rule is said to be checked incompletely, since a left-out feature can make its neighbours' issues there (a gap where it lay, a dangle where it joined).
    • Rules checked in a layer's projected system: an issue at a place that can't be given in longitude/latitude is kept, with no place. The answer gives located: false with null lon/lat, the Error Inspector selects its features without zooming, and a notice counts these issues. Before, the whole check was refused.
  • Offline sync (offline.sync, and a field package that goes back as a whole map): a source feature with such a place outside the area stays as stored (merged_from_lonlat takes it as the source holds it). Before, one such feature anywhere in the source layer refused every sync of every area. One the area holds can't be compared with the area's copy, and still refuses the sync, now naming it.

Deliberately unchanged:

  • Publish write-back, GeoPackage and PostGIS edit saves: still strict, since a write-back must not lose geometry.
  • Field Package return by the list of changes: still refuses for any such feature of the layer, naming it. Making it lenient changes the format of the copy kept on the phone, so it stays for a later piece. The user guide says so.

Also from earlier threads:

Memory

No new copies.

  • Edits: each feature is converted as before. The conversion is made once per layer rather than once per feature.
  • Sync: the lenient copy replaces the strict one, as large.
  • Paste: converts the clipboard's copy in place.

Reach

  • Gets it: everything that runs these commands (desktop, browser, CLI, Python, the Assistant and MCP): edit.move, edit.rotate, edit.scale, edit.flip, edit.split, edit.cutPolygon, edit.vertex, edit.reshape, edit.trace, edit.merge, shape conversion, edit.paste, topology.validate, offline.sync and the whole-map field package return.
  • Interface: no command or parameter changes. topology.validate's issues gain located.
  • Way back: each edit is one Undo step, as before.

Testing

  • New crates/engine/src/tests/unplaced_edits.rs, 6 tests, on layers held in Robinson (and one in UTM) with FAR = (1e12, 1e12):
    • Selection edits: Move, Rotate and Scale with and without the far features. The far line is kept bit for bit, with one notice by layer; the refusal for a far-only selection; Flip in own coordinates.
    • Split and Cut Polygon: both ways, plus the refusals.
    • One-feature edits: vertex, Reshape and Merge name the feature.
    • Paste: leaves the far line out.
    • Topology in longitude/latitude: leaves the far features out, says so and marks the rules incomplete.
    • Topology in UTM: keeps the far issue with located: false.
  • held_layers.rs: a_sync_leaves_a_source_feature_it_cant_place_as_stored, which fails without the fix ("cannot sync layer 'Wells': … feature 10 … can't be given in longitude/latitude"), and the refusal naming a feature the area holds.
  • design.rs: the topology test that pinned the old refusal now pins the new behaviour, with layers named as the map has them.
  • Clippy -D warnings, fmt, the engine suite, cargo xtask rows, schema and the wasm build as CI runs it pass. Five reader tests (four in rustgis-data, and the engine's GDAL reload test) fail locally on this machine, as they did for Geoprocessing reads a feature it can't place in longitude/latitude without its geometry, and says so (#2032 C2f-4b-1b) #2798; this PR changes none of the readers they test.
  • An independent review before opening found:
    • the neighbours' issues in topology, now said as an incomplete rule;
    • the graphics-field leak on a refused paste;
    • the missing located marker;
    • the Field Package wording.
      All are fixed here.

Summary by CodeRabbit

  • Bug Fixes

    • Editing and paste operations now continue with features that can be placed, while skipping and reporting features that cannot be represented in the required coordinate system.
    • Topology checks retain errors that cannot be located on the map and indicate when checks are incomplete.
    • Offline sync preserves unplaceable features outside the synced area and reports when a feature inside the area cannot be compared.
    • Routing and coordinate-system handling work more reliably with projected data.
  • Documentation

    • Updated guidance on coordinate transformations, editing unplaceable features, topology results, paste, and field-package sync.

…where in it; shortest_route_held takes the layer; data.md names when the direct operation draws; a stale comment (opengeos#2032 C2f-8, C2f-4b-1b, C2f-5)
… can't be given in longitude/latitude, or name it (opengeos#2032 C2f-4b-1c)
…t a feature out is said to be incomplete; topology issues answer located; Field Package return documented (opengeos#2032 C2f-4b-1c)
@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The changes update coordinate conversion and routing, editing and paste operations, topology validation, and offline synchronization to handle features that cannot be represented in longitude/latitude. They also add tests and user-guide updates for these behaviors.

Changes: Unplaceable feature handling

Layer / File(s) Summary
Coordinate conversion and routing
crates/data/src/lib.rs, crates/data/src/raster/planetary.rs, crates/analysis/src/network.rs, crates/engine/src/cmd/workflows.rs, crates/engine/src/shape_conversion.rs, docs/user-guide/data.md, crates/engine/src/cmd/navigate.rs
Dataset adds feature-aware longitude/latitude conversion. Route graph construction uses the held dataset, and PROJ axis parsing searches the full definition. The coordinate-system guide distinguishes local-area maps from world projections.
Editing and paste behavior
crates/engine/src/cmd/clipboard.rs, crates/engine/src/cmd/design.rs, crates/engine/src/cmd/design/sketch.rs, crates/engine/src/tests.rs, crates/engine/src/tests/unplaced_edits.rs, docs/user-guide/editing.md
Editing, sketching, and paste skip or reject features that cannot be converted, with counts or feature-specific errors. Tests and the editing guide cover these outcomes.
Topology results and navigation
crates/engine/src/cmd/design.rs, crates/engine/src/tests/unplaced_edits.rs, crates/ui-egui/src/editpanes.rs, docs/user-guide/editing.md
Topology checks omit unplaceable features from longitude/latitude checks, retain issues without locations, and mark affected rules incomplete. Responses include a located flag, and the UI skips navigation when coordinates are non-finite.
Offline synchronization
crates/engine/src/cmd/workspace.rs, crates/engine/src/tests/held_layers.rs, docs/user-guide/field-work.md
Offline synchronization preserves unplaceable source rows outside the synced area and refuses comparison when an affected feature belongs to the area.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant topology_validate
  participant check_topology
  participant Dataset
  participant Error_Inspector
  topology_validate->>check_topology: validate topology
  check_topology->>Dataset: convert features to longitude/latitude
  Dataset-->>check_topology: converted data and omitted features
  check_topology-->>topology_validate: issues, notices, and incomplete rules
  topology_validate-->>Error_Inspector: issues with located status
  Error_Inspector->>Error_Inspector: navigate only when coordinates are finite
Loading

Possibly related issues

  • opengeos/RustGIS#2032: The issue’s Phase C lists handling features without longitude/latitude positions in editing, paste, topology, and offline synchronization; this PR implements behavior in those areas.

Possibly related PRs

  • opengeos/RustGIS#2580: That PR keeps file-backed layers in native coordinate systems, a condition handled by this PR’s conversion, editing, and topology changes.

Suggested reviewers: giswqs, mavrick-f, pawelkra

Merge Risk: Minimal · up to f845b

This change lets edits, paste, topology checks and offline sync continue when a feature cannot be placed in longitude/latitude. Skipped features are reported to the user, and strict paths such as publish and database saves stay refused. Review found no remaining concrete defect, and the change is ready to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names edits, paste, topology and offline sync with a feature that has no longitude/latitude place, which matches the changeset. It also cites the tracking reference C2f-4b-1c, which is a min…
Description check Passed The description covers the summary, the behaviour changes by command, memory and reach notes, and a detailed testing section. The template's Summary and Testing sections are filled in. The UI evidence…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names edits, paste, topology and offline sync with a feature that has no longitude/latitude place, which matches the changeset. It also cites the tracking reference C2f-4b-1c, which is a minor detail. The title is long (109 characters) and dense, but it still states the main change.

Full details: Description check

Explanation

The description covers the summary, the behaviour changes by command, memory and reach notes, and a detailed testing section. The template's Summary and Testing sections are filled in. The UI evidence section is present and states 'No visible UI change.', as the template allows. The Related issue section is not filled in. It references #2032 and earlier PRs in the Summary text, but it does not use the 'Part of #...' line the template asks for.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

A rabbit maps the winding trail,
And skips the spots beyond the scale.
The edits pass where points can land,
Unlocated issues stay at hand.
Then hops home, coordinates planned.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 35cc644a-99d5-4c7a-a29e-563e8325cd2e
Commits

Reviewing files that changed from the base of the PR and between 182a8e9 and f845bf2.

Files selected for processing: 17

  • crates/analysis/src/network.rs
  • crates/data/src/lib.rs
  • crates/data/src/raster/planetary.rs
  • crates/engine/src/cmd/clipboard.rs
  • crates/engine/src/cmd/design.rs
  • crates/engine/src/cmd/design/sketch.rs
  • crates/engine/src/cmd/navigate.rs
  • crates/engine/src/cmd/workflows.rs
  • crates/engine/src/cmd/workspace.rs
  • crates/engine/src/shape_conversion.rs
  • crates/engine/src/tests.rs
  • crates/engine/src/tests/held_layers.rs
  • crates/engine/src/tests/unplaced_edits.rs
  • crates/ui-egui/src/editpanes.rs
  • docs/user-guide/data.md
  • docs/user-guide/editing.md
  • docs/user-guide/field-work.md
Files with no reviewable changes: 2

  • crates/engine/src/cmd/navigate.rs
  • crates/engine/src/cmd/workflows.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Comment thread crates/data/src/lib.rs
/// [`Dataset::geometry_to_lonlat`] of `g`, feature `id`'s geometry, for an edit of that one
/// feature: refused naming the layer and the feature when one of its places can't be given in
/// longitude/latitude, so it can't be edited there.
pub fn feature_to_lonlat<'a>(&self, id: u64, g: &'a Geometry) -> std::result::Result<Cow<'a, Geometry>, String> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feature_to_lonlat names self.name, the dataset's name, in its refusal. The file already notes that a layer's map name can differ from its data's name after a name clash (the named closure in check_topology, and the sync path using own.name), and the PR's own topology test is written around that. This error can therefore name a different layer than the one the user sees on the map.

Suggested fix: take the map layer name as a parameter from the callers (they already have l.name), or document in the doc comment that the name is the data's name so callers that know the map name can replace it.

Category: quality

let mut keep = placed.into_iter();
src.features.retain_rows(|_| keep.next().unwrap_or(true));
if src.features.is_empty() {
return Err(format!("Paste: the copied feature(s) have a place {} ({}) can't hold", l.name, own.label()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wording reads as if the layer's name were a place: "the copied feature(s) have a place plain (Robinson) can't hold". Make the layer the subject, as the notice below does: "Paste: the copied feature(s) have a place that layer {} ({}) can't hold".

Category: quality

/// command line call commands one at a time on the session and use each answer before the next,
/// so they check where they ask, with the work limit of a run that can't be cancelled. A registered
/// window owner refuses an unprepared nonempty check instead of computing it inline.
/// One issue as `topology.validate` answers it. `located` is false for an issue at a place that

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This inserted block splits the doc comment of topology_validate. Its description ("Checks every topology rule; the errors are kept for the Error Inspector…", lines 2727–2734) now sits above issue_json, and topology_validate loses its doc.

Suggested fix: move this issue_json block (its two doc lines and the fn) above the Checks every topology rule comment, so that comment stays with topology_validate.

Category: quality

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I reviewed the whole PR diff, the base-branch AGENTS.md, and the surrounding code for the routing build (Network::build), merged_from_lonlat, retain_rows, set_geometry and the topology consumers. There were no prior review threads, so no concerns were skipped as already raised.

Bugs

None confirmed. I checked the paste conversion ordering and row bookkeeping, the Move/Flip/Split/Cut paths, the route build (which converts each line as it reads it), the offline-sync refusal and write-back, and the topology NaN handling. The editpanes consumer guards on is_finite, and no other consumer reads lon/lat from topology errors.

Security

None found.

Performance

None found. The conversion is now done once per layer instead of once per feature in the edit paths. Sync holds the same number of full copies as before.

Quality

  • Doc comment split (crates/engine/src/cmd/design.rs, inline): the topology_validate doc now sits above issue_json. Confidence high.
  • Layer name in feature_to_lonlat (crates/data/src/lib.rs, inline): it names the dataset's name, not the map layer's, which can differ after a name clash. Confidence medium.
  • Paste refusal wording (crates/engine/src/cmd/clipboard.rs, inline): "have a place {layer} ({crs})" reads as if the layer name were a place. Confidence high.
  • Nit, not posted: docs/user-guide/editing.md has one over-long wrapped line in the Paste paragraph (the "Paste Special" sentence). Confidence high.

AGENTS.md

No breaks found. The new refusals and notices are one per kind with counts, the Cancel and background paths are unchanged, and no command was added or renamed.

Questions I did not post

  • Offline sync and notices (low confidence): a source feature with no longitude/latitude place, outside the area, is left as stored with no notice. Nothing is dropped, so this may be acceptable, but the "Never silent" rule asks for a notice when features are skipped. The PR should say whether this was deliberate.
  • Covering layer left out (low confidence): when a covering polygon is left out of a Must Be Covered By check, the features it covers are still reported as errors. The rule is marked incomplete, which the PR documents, so this is disclosed rather than silent.

Change size

Compared with the base branch (merge base 182a8e9 to PR head f845bf2). The stats were not truncated.

Measure Value
Files changed 17 (1 added, 16 modified, 0 removed, 0 renamed)
Size before 4.6 MB
Size after 4.6 MB
Total size change +26.2 KB
Path Before After Change
crates/engine/src/tests/unplaced_edits.rs 0 B 12.8 KB +12.8 KB
crates/engine/src/cmd/design.rs 154.6 KB 160.0 KB +5.4 KB
crates/engine/src/tests/held_layers.rs 161.1 KB 163.1 KB +2.0 KB
crates/engine/src/cmd/clipboard.rs 16.4 KB 17.7 KB +1.3 KB
crates/engine/src/cmd/workspace.rs 72.0 KB 73.2 KB +1.3 KB
docs/user-guide/editing.md 46.1 KB 47.1 KB +1.0 KB
crates/engine/src/cmd/design/sketch.rs 13.6 KB 14.4 KB +0.8 KB
crates/data/src/lib.rs 96.3 KB 96.9 KB +0.7 KB
docs/user-guide/field-work.md 19.1 KB 19.6 KB +0.5 KB
crates/data/src/raster/planetary.rs 30.2 KB 30.5 KB +0.3 KB
crates/ui-egui/src/editpanes.rs 28.2 KB 28.5 KB +0.2 KB
crates/engine/src/cmd/navigate.rs 85.9 KB 85.8 KB -0.2 KB
docs/user-guide/data.md 153.2 KB 153.4 KB +0.2 KB
crates/analysis/src/network.rs 94.6 KB 94.5 KB -0.1 KB
crates/engine/src/tests.rs 3.5 MB 3.5 MB +56 B
crates/engine/src/cmd/workflows.rs 123.6 KB 123.5 KB -55 B
crates/engine/src/shape_conversion.rs 38.4 KB 38.5 KB +43 B

@pick2510
pick2510 enabled auto-merge November 24, 2026 08:10
@github-actions

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-2842/
Web app https://preview.rustgis.app/pr-2842/app/
Commit f845bf2

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 preview label (once per commit).

@pick2510
pick2510 added this pull request to the merge queue Nov 24, 2026
Merged via the queue into opengeos:main with commit ed28324 Nov 24, 2026
27 checks passed
@pick2510
pick2510 deleted the crs-unplaced-edits branch November 24, 2026 08:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant