Skip to content

feat(layout): type the map extent's coordinates in the Layout Wizard - #3323

Merged
jgregoriorincon merged 4 commits into
opengeos:mainfrom
jgregoriorincon:feat/3307-wizard-extent-coordinates
Nov 29, 2026
Merged

jgregoriorincon merged 4 commits into
opengeos:mainfrom
jgregoriorincon:feat/3307-wizard-extent-coordinates

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Layout Wizard's Map step framed the view, a layer or the selection. It now also takes Coordinates: West, East, South and North as longitude and latitude (WGS 84) in decimal degrees, whatever the map's projection (a decimal comma too), for a sheet or figure that must cover an exact area. layout.publication already takes extent, so the engine is unchanged.

  • The fields are filled from the view when the choice is first picked, rounded outward to five decimals, and keep what they hold as the view moves or another choice is tried. A view that crosses ±180° is cut there, as View is.
  • They are held to ±180° and ±90°. West not less than East, or South not less than North, is said under the fields; the review then reads "(none)" and Create says why and makes nothing.
  • On a map on the globe the choice is off; one picked before the map moved to the globe is refused the same way.
  • A value holds while it is being typed, so Next without Enter keeps it.
  • Asked as the sheet is made: the map frame's properties don't take coordinates afterwards. An area crossing ±180° can't be typed.

Surfaces: the wizard dialog, shared by desktop and browser. Commands (CLI, Python, the Assistant) already take extent, and Create runs the same command as before.

New strings wait for the release translation pass.

Not in this PR: typing the area in the map's own coordinate system, which is #3322.

Testing

Tests in publicationwizard/map.rs for each case above, plus Create for a sheet, a figure and the whole world on Web Mercator, the fields inside a 420 pt wide window, and Cancel.

Local, before the first push: cargo fmt --all --check, cargo clippy on rustgis-ui-egui with -D warnings, cargo nextest (10,777 passed, 29 skipped; two DuckDB tests that fail on this machine are left out), doctests, cargo xtask layers and cargo xtask schema --check. After the last fix: fmt, clippy on rustgis-ui-egui and its 162 wizard tests. Screenshots from ui_shot.

UI evidence

Map step, before and after (the fields filled from the view):

c1-before-after.png

An area out of order, and the review of a typed one:

c2-invalid-review.png

The sheet Create made from those coordinates:

c3-sheet.png

Related issue

Closes #3307

Summary by CodeRabbit

  • New Features
    • Added a Coordinates option to set a layout’s map extent using editable longitude and latitude bounds. Values initialize from the current view when possible, or default to the whole Earth.
    • Coordinate bounds appear in the review step and are applied when creating the layout. West must be less than east, and south less than north.
  • Documentation
    • Updated the layout guide with coordinate requirements and limitations, including antimeridian and globe-projection restrictions, and that extents cannot be changed afterward.
    • Clarified how layouts are named when no name is provided.

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The publication wizard adds a WGS 84 coordinate option for map extents. The fields initialize from the current view and validate coordinate ordering and globe compatibility. Review displays valid bounds, and Create passes them to extent resolution.

Changes: Coordinate-based map extent

Layer / File(s) Summary
Coordinate entry and validation
crates/ui-egui/src/publicationwizard/map.rs
The Map step adds coordinate fields initialized from the view, rounds and clamps their defaults, and validates bounds. The option is disabled for globe projections. Tests cover input, persistence, validation, globe handling, and Create behavior.
Extent review and creation
crates/ui-egui/src/publicationwizard/map.rs, crates/ui-egui/src/publicationwizard/mod.rs, crates/ui-egui/src/publicationwizard/review.rs, docs/user-guide/layouts.md
The draft stores optional coordinates. Review displays valid bounds, and Create passes them to extent resolution without framing. The guide documents coordinate limits and wizard behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant MapStep
  participant Draft
  participant ReviewStep
  participant LayoutCreation
  participant area_extent
  User->>MapStep: Select Coordinates and edit bounds
  MapStep->>Draft: Store coordinate values
  ReviewStep->>Draft: Read coordinate values
  ReviewStep->>area_extent: Format bounds for the review label
  User->>LayoutCreation: Request layout creation
  LayoutCreation->>area_extent: Resolve extent using draft coordinates
  area_extent-->>LayoutCreation: Return valid extent or error
Loading

Possibly related issues

Possibly related PRs

Suggested reviewers: giswqs, elpidioassinaturas

Merge Risk: Minimal · up to 7725f

The Layout Wizard gains a Coordinates choice for typing the map extent. No actionable merge-blocking risk was found in the supplied changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "feat(layout): type the map extent's coordinates in the Layout Wizard" names the main change: a new Coordinates choice in the Layout Wizard's Map step where users type West, East, South and …
Description check Passed The description follows the template's sections: Summary, Testing, UI evidence and Related issue. The Summary explains what changed and why. Testing lists the local checks and the tests added. UI evid…
Linked Issues check Passed [#3307] The only directly linked issue is open and has coding requirements. The change summary shows each requirement implemented: (1) a fourth Map-step choice, Coordinates, in map.rs (Area::Coordinat…
Out of Scope Changes check Passed The changed files are map.rs, mod.rs (Draft.coords field), review.rs (passes d.coords to area_label), and docs/user-guide/layouts.md. The code changes all serve the Coordinates objective from #3307. T…
Full details: Title check

Explanation

The title "feat(layout): type the map extent's coordinates in the Layout Wizard" names the main change: a new Coordinates choice in the Layout Wizard's Map step where users type West, East, South and North values. The changeset adds this in map.rs, mod.rs, review.rs and the layouts docs, so the title matches the primary change. It is specific and about 68 characters.

Full details: Description check

Explanation

The description follows the template's sections: Summary, Testing, UI evidence and Related issue. The Summary explains what changed and why. Testing lists the local checks and the tests added. UI evidence includes before/after and review screenshots, as the template requires for visible UI changes. Related issue states 'Closes #3307'. The description is thorough and complete.

Full details: Linked Issues check

Explanation

[#3307] The only directly linked issue is open and has coding requirements. The change summary shows each requirement implemented: (1) a fourth Map-step choice, Coordinates, in map.rs (Area::Coordinates); (2) West, East, South and North fields initialized from the view, rounded outward to five decimals and clamped to Earth bounds; (3) values held while the user edits and when switching choices; (4) validation that West is less than East and South less than North, shown on the step; (5) the review shows the values, and Create passes them as extent through area_extent; (6) the choice is refused on globe maps, including a prior selection after the map changes to a globe; (7) areas crossing ±180° are not accepted; (8) coordinates are asked only at sheet creation, not as frame properties. The summary reports tests for these cases in publicationwizard/map.rs. Evidence is the change summary and PR description. The repository diff could not be read (changed blobs unavailable), so the code was not checked directly.

Full details: Out of Scope Changes check

Explanation

The changed files are map.rs, mod.rs (Draft.coords field), review.rs (passes d.coords to area_label), and docs/user-guide/layouts.md. The code changes all serve the Coordinates objective from #3307. The documentation change describes the Coordinates option, which is in scope. It also adds a sentence on the default layout name Publication and numbering of a duplicate name. That sentence concerns the same wizard Name field shown in the PR screenshots, and no code change for it appears in the summary. The docs diff could not be read, so its exact wording is unverified. No demonstrated unrelated change was found.

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 bounds with care,
West and east, then north and south.
Five small decimals find their place,
The view provides a starting trace.
The wizard keeps the values near,
And sends the extent when sheets appear.

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: c3329183-5963-4b4f-923c-3ff61579692d
Commits

Reviewing files that changed from the base of the PR and between 3faa1b3 and 7725fe6.

Files selected for processing: 1

  • crates/ui-egui/src/publicationwizard/map.rs

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

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues or AGENTS.md violations. I could not build or run the tests (no shell here), so everything below is from reading the diff and the surrounding source.

Bugs: none found. Checked: every caller of held, area_label and area_extent (map step, review, Create and the tests) passes the new coords argument. view_extent is lon/lat, so from_view clamps the right quantity. The Create path refuses a bad area and keeps the wizard open. A NaN coordinate can't pass, because the ordering filter is false for every NaN comparison.

Security: none found.

Performance: none. held and from_view run per frame but do constant work, and nothing here touches layer data.

Quality:

  • A typed NaN passes f64::parse and gets the "West must be less than East…" message instead of a field-level one. Inline comment posted on crates/ui-egui/src/publicationwizard/map.rs:88 with a suggestion. Confidence medium on the egui side, high on the parse behaviour.
  • Area::Coordinates is documented as "whatever the map", but the globe is refused (map.rs, held). The doc should say "not on a globe". Confidence high. Nit.
  • Typed values outside ±180/±90 are clamped by the field's range, so "200" becomes 180 with no notice. The field shows the clamped value and the docs state the limit, so this is by design. Whether it falls under "Never silent" is a judgement call. Confidence low.
  • so for South is an unclear abbreviation in from_view, held and coordinate_fields. Nit.

AGENTS.md: no violations found. Interface strings use tl! or i18n::fmt. Non-test code has no unwrap, expect or unsafe. The change adds no command, so the command-surface snapshot and schema don't change. The rustgis_engine::cmd::workspace::view_extent and rustgis_engine::geom imports resolve to public items. I did not check the wasm build.

Earlier review threads: none on this PR, so none were left alone.

Change size

Compared: the whole PR against main (merge base 69eeaee to PR head 3faa1b3).

Measure Value
Files changed 4 (added 0, modified 4, removed 0, renamed 0)
Size before 168.0 KB
Size after 183.5 KB
Total size change +15.5 KB
Path Before After Change
crates/ui-egui/src/publicationwizard/map.rs 19.9 KB 34.6 KB +14.7 KB
docs/user-guide/layouts.md 88.8 KB 89.3 KB +538 B
crates/ui-egui/src/publicationwizard/mod.rs 47.6 KB 47.8 KB +229 B
crates/ui-egui/src/publicationwizard/review.rs 11.6 KB 11.7 KB +10 B

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3323/
Web app https://preview.rustgis.app/pr-3323/app/
Commit 7725fe6

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).

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the summary points:

  • Values held to ±180/±90 with no notice: intended. The field shows the held value as soon as it is typed, and the guide states the limits.
  • so for south: s is the session in these functions, as in layout.publication.
  • The out-of-scope check on the guide: the sentence about the Publication name is unchanged; the diff touches its line because the Coordinates sentences follow it.

@github-actions

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security issues or AGENTS.md breaks in this PR. The change is a Coordinates option in the Layout Wizard's map step, with the engine unchanged. I checked it against the rules that apply to these files, and the one remaining point is a small quality nit.

Bugs

None found. What I checked:

  • Typed extent is passed through unchanged. area_extent returns the typed [w, s, e, n] as-is. view_extent (crates/engine/src/cmd/workspace.rs:497) returns lon/lat, so the view's fill and the typed values use the same units.
  • Order and NaN. held requires w < e && s < n, and the field parser now drops non-finite values, so NaN can't reach the check or the range. The earlier NaN thread is fixed (the parser filters non-finite values) and is not re-raised.
  • Other Area matches. Only elements.rs:127 (whole_globe) special-cases Area::View on a globe. Coordinates is refused on a globe, so Create can't produce a whole-globe sheet from it. No change needed there.
  • Globe and map switch. The globe check in held covers a pick made before the map moved to a globe. coords survive a map switch by design, as the doc says.
  • Panics. Non-test code has no unwrap/expect; coords.get_mut is used rather than indexing.

Security

None found. The input is a local UI field, and there is no file, network or command surface change.

Performance

None found. held and area_label are constant-time for this variant, and from_view runs once when the choice is first picked.

Quality

  • Silent clamp and revert (inline comment posted, confidence high). A typed value past ±180/±90 is clamped by DragValue::range, and unparseable text reverts the field. Both are visible in the field, and the NaN case is tested. Nit: a hint or a test pinning the clamp would make it explicit.
  • held with coords: None (confidence medium, not reachable in the UI). It reports the "West must be less than East…" message. get_or_insert_with fills the value in the same frame the choice is made, so the state doesn't arise in practice. A distinct message, or treating it as "not yet filled", would be clearer.
  • Valid-input "no message" test. The "test both ways" rule is covered by the Create and hold tests, but no test asserts that a valid typed area shows no warning. Minor.

AGENTS.md

No breaks found.

  • New strings use tl! and i18n::fmt.
  • No command, command surface, saved file or schema changes, so command-surface.txt and schema/ need no update.
  • The PR body covers the surfaces: desktop and browser share the wizard, and the engine's layout.publication already takes extent for CLI, Python and the Assistant.
  • No new assets, dependencies or ribbon entries.

Prior reviews

One thread (the NaN parsing on line 88) was already raised. It is resolved, outdated, and fixed in 7725fe6, so I did not repeat it. I left one concern alone for that reason, and posted one new inline nit on the same spot covering a different point (the silent clamp).

Change size

Compared with the base branch (merge base 69eeaee to PR head 7725fe6), the whole PR against main.

Measure Value
Files changed 4 (0 added, 4 modified, 0 removed, 0 renamed)
Size before 168.0 KB
Size after 184.2 KB
Total size change +16.2 KB
Path Before After Change
crates/ui-egui/src/publicationwizard/map.rs 19.9 KB 35.4 KB +15.5 KB
docs/user-guide/layouts.md 88.8 KB 89.3 KB +538 B
crates/ui-egui/src/publicationwizard/mod.rs 47.6 KB 47.8 KB +229 B
crates/ui-egui/src/publicationwizard/review.rs 11.7 KB 11.7 KB +10 B

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the other summary points: held with no coordinates can't happen from the step, which fills them in the frame the choice is made. A valid area showing no message is not worth a test of its own.

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Nov 29, 2026
Merged via the queue into opengeos:main with commit 182ca32 Nov 29, 2026
30 checks passed
@jgregoriorincon
jgregoriorincon deleted the feat/3307-wizard-extent-coordinates branch November 29, 2026 11:12
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.

[Feature]: Type the map extent's coordinates in the Layout Wizard

1 participant