Skip to content

fix(geom): switch measurement units for negative distances and areas (#1284) - #1285

Merged
deniial00 merged 2 commits into
opengeos:mainfrom
TalhaHunter101:fix/negative-measurements-unit-switching
Nov 1, 2026
Merged

deniial00 merged 2 commits into
opengeos:mainfrom
TalhaHunter101:fix/negative-measurements-unit-switching

Conversation

@TalhaHunter101

@TalhaHunter101 TalhaHunter101 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

When formatting negative distances or areas, unit promotion thresholds were compared against signed positive constants (m.round() < 1000.0, (m / 100.0).round() < 1000.0, m2.round() < 1.0e6, ft.round() < 5280.0, etc.). Because negative values are always less than positive thresholds, negative measurements never scaled to larger units (such as km, km², mi, or acres), displaying values like "-12500 m" instead of "-12.5 km" or "-65617 ft" instead of "-12.4 mi".

This updates the threshold comparisons to check magnitude with .abs() (matching how mm.abs() and cm.abs() are already handled), scaling negative distances and areas symmetrically with positive ones while preserving their signs.

Testing

  • Added test cases in crates/geom/src/lib.rs for negative metric distance thresholds (-850 m, -999 m, -1.0 km, -12.5 km, -99.9 km, -100 km) and area thresholds (-999999 m², -1.0 km², -5.0 km²).
  • Added test cases in crates/ui-egui/src/measure_units.rs for imperial negative distance (-1 ft, -1.0 mi, -12.4 mi) and negative area (-1 ft², -1.0 acres, -10.0 acres, -1.0 mi², -3.9 mi²).
  • Ran cargo test -p rustgis-geom (all 17 tests passed).
  • Ran cargo test -p rustgis-ui-egui --lib -- measure_units (passed).
  • Ran cargo clippy -p rustgis-geom -p rustgis-ui-egui --all-targets -- -D warnings (passed, 0 warnings).

Related issue

Fixes #1284

Summary by CodeRabbit

  • Bug Fixes
    • Negative distance and area measurements now use the same unit thresholds as positive measurements in both metric and imperial formats, while retaining their negative sign.
    • Metric unit selection accounts for rounding near thresholds, improving consistency for values close to unit boundaries.
  • Documentation
    • Clarified that non-finite distance values display as an em dash.

@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 15 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 8 included reviews currently available.

Learn how review limits work.

Review configuration:

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: f2d50e00-c50a-4327-9502-1bb9d62c6546
Commits

Reviewing files that changed from the base of the PR and between 337358b and f4613ec.

Files selected for processing: 1
  • crates/geom/src/lib.rs

No actionable comments were generated in the recent review.

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: f8d37fc0-b783-4526-a26b-0efb834b023e
Commits

Reviewing files that changed from the base of the PR and between d04b144 and 337358b.

Files selected for processing: 2
  • crates/geom/src/lib.rs
  • crates/ui-egui/src/measure_units.rs

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

Walkthrough

Metric and imperial distance and area formatters now select units using absolute magnitude. Formatted values retain their negative sign. Tests cover negative measurements around unit thresholds.

Changes: Negative measurement formatting

Layer / File(s) Summary
Magnitude-based unit selection
crates/geom/src/lib.rs, crates/ui-egui/src/measure_units.rs
Metric and imperial distance and area formatters use absolute magnitude to select units. Tests check negative values across unit thresholds.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Possibly related PRs

  • opengeos/RustGIS#719: Adds the imperial distance and area formatters whose unit-selection thresholds this change updates.
  • opengeos/RustGIS#923: Adds sub-metre unit selection and rounding in format_distance, which this change extends to larger unit thresholds.

Suggested reviewers: mavrick-f, subarna-kandel

Merge Risk: Minimal · previous review 33735

The negative-value unit promotion changes are mergeable after normal checks. The previously reported sub-millimetre sign limitation is not introduced by this change.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title names the fix and its scope: negative distances and areas now switch to larger measurement units. It matches the raw summary and the linked objectives. It is specific and readable, and the i…
Description check Passed The description follows the template's sections: Summary, Testing, UI evidence, and Related issue. The Summary explains the cause and the fix. The Testing section lists the added test cases and the co…
Linked Issues check Passed Issue #1284 requires magnitude-based unit promotion for negative distances and areas while preserving the sign. crates/geom/src/lib.rs now uses absolute rounded magnitudes for metric distance and ar…
Out of Scope Changes check Passed The changes remain within issue #1284. They modify the four specified formatting functions and add focused automated tests for the required negative-value behavior. No unrelated API or behavior change…
Docstring Coverage Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Full details: Title check

Explanation

The title names the fix and its scope: negative distances and areas now switch to larger measurement units. It matches the raw summary and the linked objectives. It is specific and readable, and the issue number matches the linked issue. The title is 76 characters, which is slightly long but acceptable.

Full details: Description check

Explanation

The description follows the template's sections: Summary, Testing, UI evidence, and Related issue. The Summary explains the cause and the fix. The Testing section lists the added test cases and the commands run with results. The UI evidence section keeps the 'No visible UI change.' line, which the template allows when no visible UI change exists. The Related issue section says 'Fixes #1284'. The description is complete and specific.

Full details: Linked Issues check

Explanation

Issue #1284 requires magnitude-based unit promotion for negative distances and areas while preserving the sign. crates/geom/src/lib.rs now uses absolute rounded magnitudes for metric distance and area thresholds. crates/ui-egui/src/measure_units.rs now uses absolute rounded feet and absolute area for imperial thresholds. Existing formatting retains the signed value. Added tests cover negative metric and imperial distance and area thresholds.

Full details: Out of Scope Changes check

Explanation

The changes remain within issue #1284. They modify the four specified formatting functions and add focused automated tests for the required negative-value behavior. No unrelated API or behavior changes are identified in the supplied whole-PR summary.

Full details: Docstring Coverage

Explanation

Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 5 functions across 2 files.

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 checks the measured mile,
Then keeps the minus sign in style.
From metres small to acres wide,
The thresholds now use magnitude.
The numbers keep their proper sign,
And tests mark every boundary line.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Code review

Bugs: None found. The change makes the unit-promotion thresholds in format_distance, format_area, measure_units::distance and measure_units::area compare magnitudes, so negative values now scale to km, km², mi and acres like positive ones. I checked each new assertion by hand against the thresholds and rounding, and all of them produce the expected strings. Boundary rounding is symmetric (for example -999.5 m becomes -1.0 km, the same as +999.5 m). The non-finite guards run before every .abs() call, so NaN and infinity still return —. I could not run the test suite in this environment, so these results come from reading the code. Confidence: high.

Security: None. The change adds no input parsing, no I/O and no unwrap/expect/unsafe.

Performance: None. The extra .abs() calls are trivial.

Quality: Nit, low confidence it matters. m.abs() is recomputed in several branches of format_distance, and ft.abs() / m2.abs() appear in the same way in measure_units.rs. Binding let a = m.abs(); once would read more cleanly, but this is optional. The doc comments on measure_units::distance and area still say "Positive sub-foot values…" and "Positive sub-square-foot values…". whole_or_small already handled negatives, and this PR's tests now cover that, so the word "Positive" is misleading. I did not post this inline because those doc lines are outside the diff hunks.

AGENTS.md: Compliant. The new literals reuse existing i18n::fmt strings, so no new tl! strings or catalog changes are needed. No dependencies or assets changed. The PR adds no panics and no silent data loss, so the never-crash and never-silent rules do not apply to this change.

Prior review threads: none on this PR, so no earlier concerns were left alone.

Change size

Compared with main (merge base 6692b1b to PR head abd08e3), the whole PR.

Measure Value
Files changed 2 (added 0, modified 2, removed 0, renamed 0)
Size before 30.0 KB
Size after 31.2 KB
Total size change +1.2 KB
Path Before After Change
crates/geom/src/lib.rs 26.7 KB 27.3 KB +667 B
crates/ui-egui/src/measure_units.rs 3.3 KB 3.9 KB +612 B

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-1285/
Web app https://preview.rustgis.app/pr-1285/app/
Commit f4613ec

GitHub Pages takes a minute or two to publish a new commit.

@TalhaHunter101
TalhaHunter101 force-pushed the fix/negative-measurements-unit-switching branch from abd08e3 to 54fd5fb Compare November 1, 2026 19:19
Comment thread crates/geom/src/lib.rs
} else if m != 0.0 && cm.abs() < 100.0 {
format!("{cm:.0} cm")
} else if m.round() < 1000.0 {
} else if m.abs().round() < 1000.0 {

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 sign-aware thresholds look right. f64::round rounds half away from zero, so m.abs().round() matches the positive path exactly, and the new tests cover the boundaries (999.5, 99.95 km, 1 acre, 1 mi²).

What I couldn't confirm is that anything reaches these functions with a negative value. In the UI, the measure tool's area comes from wgs84_ring_perimeter_area_m2, which returns an unsigned area. The ribbon clip and label distances are fixed positive constants. The elevation formatter has no unit thresholds, so it isn't affected. Could you point to the path behind #1284 (a stored value, a CLI or Python output, or a tool result)? If it goes through format_distance, a test at that call site would show the fix end to end.

@TalhaHunter101 TalhaHunter101 Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

format_distance and format_area (along with measure_units::distance and measure_units::area) are public formatting utilities in rustgis_geom and rustgis_ui_egui. While the interactive polygon/path measurement tools compute non-negative geometric magnitudes, these formatters serve general-purpose display across the library, Python bindings, and downstream analysis/delta workflows (such as buffer/elevation offset deltas, net cut-and-fill area balances, or signed chainage/stationing offsets from a reference alignment).

Prior to this fix, negative values never scaled up to higher units (displaying e.g. -12500 m instead of -12.5 km) because negative numbers are always strictly less than the positive thresholds (< 1000.0, < 5280.0, etc.).

This fix is defensive at the library/public API layer to ensure symmetrical unit promotion based on magnitude while retaining the negative sign. I have also updated the doc comments on format_distance, format_area, and measure_units to document this behavior explicitly, and added sub-foot negative unit test coverage.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Code review

Bugs: None found. Both format_distance and format_area use abs().round() for the threshold, which matches the positive path exactly because round() is symmetric. Imperial distance and area also check out, including the -1 ft, -1 acre and -5280 ft edges. Non-finite inputs still return early. (high confidence)

Security: None. No new parsing or input handling. (high confidence)

Performance: None. (high confidence)

Quality: Nothing blocking. The two inconsistent threshold styles (imperial distance compares the rounded value, imperial area compares the raw value) predate this PR, so I left them alone. The new tests cover the boundaries well. (medium confidence)

AGENTS.md: Compliant. No unwrap/panic added, no new user-visible literals needing tl!, no dependencies, and geom stays below L6. (high confidence)

Open question (posted inline on crates/geom/src/lib.rs:435): I could not find a path in the current code that passes a negative distance or area into these formatters. The measure tool's area is unsigned, and the ribbon and label distances are fixed positive constants. The fix is correct for the inputs it handles, but its user-visible effect is unproven until the author names the path behind #1284. (medium confidence)

Prior review threads: none existed, so I left no earlier concerns alone.

Change size

Compared: the whole PR against main (merge base 5f9daf1 to PR head 54fd5fb).

Measure Value
Files changed 2 (added 0, modified 2, removed 0, renamed 0)
Size before 43.7 KB
Size after 44.9 KB
Total size change +1.3 KB
Path Before After Change
crates/geom/src/lib.rs 40.4 KB 41.0 KB +667 B
crates/ui-egui/src/measure_units.rs 3.3 KB 3.9 KB +612 B

@TalhaHunter101
TalhaHunter101 force-pushed the fix/negative-measurements-unit-switching branch from 54fd5fb to d04b144 Compare November 1, 2026 19:40
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no bugs or security issues in this PR. The sign handling is correct for every input I traced. One nit and one open question are below. The nit could not be posted inline because its lines are outside the diff, so it appears here.

Bugs: none found. Confidence: high.

  • format_distance, format_area, measure_units::distance and measure_units::area now compare magnitudes, so negative values pick the same unit as positive ones. I checked the new boundary tests by hand (-999.6 → -1.0 km, -99_960 → -100 km, -999_999.6 m² → -1.0 km², -10_000_000 m² → -3.9 mi²). Each expected string matches the code path.
  • The m.round() → m.abs().round() change keeps positive output identical, because round is half-away-from-zero and the sign is removed first.
  • No unwrap, expect, indexing or unsafe is introduced, so the Never-crash rules are not affected.

Security: none. The change only touches number formatting.

Performance: none. The change adds one abs() per comparison.

Quality:

  • Nit, not posted inline: the doc comment on format_distance (crates/geom/src/lib.rs, around lines 415–417) lists only positive examples. Add a line such as "A negative distance keeps its sign and picks its unit by magnitude (-12.5 km)." Confidence: high.
  • Nit: the distance/area doc comments in crates/ui-egui/src/measure_units.rs (around lines 21 and 44) say "positive sub-foot values". That was already true of the code, and the new tests cover only whole-unit negatives. Consider one negative sub-foot case, such as area(-0.1 ft²), and reword the comment to match. Confidence: medium.

AGENTS.md: no violations. No new user-visible strings, so no tl! wrapping is needed. The geom boundary tests cover both signs, which satisfies the test-both-ways rule for formatting.

Open question (already raised, left alone): the unresolved thread on crates/geom/src/lib.rs:435 asks what path delivers a negative value. The author has not answered. I checked the in-repo callers and found none that passes a negative value:

  • wgs84_ring_perimeter_area_m2 returns area.abs(), and geodesic_ring_area_m2 also ends in .abs(). Both are non-negative.
  • Path lengths are sums of haversine distances, so they are non-negative.
  • The label-pane distances, the ribbon clip distances and the scale bar all use positive constants.
  • The elevation formatter, which has no thresholds, is unchanged.

So the fix may be defensive rather than fixing a reachable bug. Please either name the path behind #1284 or note that the change is defensive. A test at that call site would show the fix end to end.

Earlier concerns left alone: 1, the thread on crates/geom/src/lib.rs:435, which is unanswered and unchanged.

Change size

Compared: the whole PR against main (merge base 5f9daf1 to PR head d04b144).

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 43.7 KB
Size after 44.9 KB
Total size change +1.2 KB
Path Before After Change
crates/geom/src/lib.rs 40.4 KB 41.0 KB +667 B
crates/ui-egui/src/measure_units.rs 3.3 KB 3.9 KB +612 B

…pengeos#1284)

Compare magnitude with .abs() against unit thresholds so negative distances
and areas scale to km, km², mi, and acres symmetrically with positive values.

Signed-off-by: Talha Shafeeq <talha.shafeeq.ts@gmail.com>
@TalhaHunter101
TalhaHunter101 force-pushed the fix/negative-measurements-unit-switching branch from d04b144 to 337358b Compare November 1, 2026 19:59
Comment thread crates/geom/src/lib.rs
/// Formats a distance in metres as `0.2 mm` / `5 mm` / `20 cm` / `850 m` / `12.5 km`: under a
/// metre in centimetres or millimetres, so a scale bar on a site plan (#902) doesn't read `0 m`.
/// Non-finite values display as `—`.
/// A negative distance keeps its sign and picks its unit by magnitude (-12.5 km). Non-finite

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.

Bug (pre-existing branch, sign lost): this doc line says a negative distance keeps its sign, but the sub-millimetre branch at crates/geom/src/lib.rs:430 does not. For m = -0.00001, tenths rounds to -0.0, so the else arm returns "< 0.1 mm" with no sign. The positive 0.00001 case is correct, so the output for the negative input is misleading.

A small fix is to pick the bound by sign at line 430, e.g. else if m < 0.0 { "> -0.1 mm".to_string() } else { "< 0.1 mm".to_string() }, and add assert_eq!(format_distance(-0.00001), "> -0.1 mm"); next to the existing 0.00001 assertion. Confidence: high on the behaviour, low on severity, since no in-app caller passes negatives (labels.distanceRange rejects them).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch. Added > -0.1 mm for sub-millimetre negative distances in commit f4613ec along with the corresponding test case.

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Code review

Bugs

  • Sub-millimetre negatives lose their sign. For format_distance(-0.00001) the branch at crates/geom/src/lib.rs:430 returns "< 0.1 mm". This branch predates the PR, but the PR's new doc line says negatives keep their sign. Posted inline. Confidence: high on the behaviour, low severity, since no in-app caller passes negatives.
  • The rest of the arithmetic checks out. abs().round() matches the positive path, the km/mi/acre/mi² boundaries pick the right unit with the sign kept, and the imperial whole_or_small path handles negatives. I traced each new test assertion by hand. I did not run the tests or fmt, since I had no shell.

Security

  • None found. The change is pure formatting with no parsing or I/O.

Performance

  • None. The added abs() calls are constant-time.

Quality

  • format_area still prints -0 m² for small negative values such as -0.3. This predates the PR and is cosmetic. Left unflagged as a nit for the release quality pass.
  • The new area line is about 100 columns, under the 140 limit in rustfmt.toml.

AGENTS.md

  • No unwrap, unsafe or new user-visible strings. The PR does not change any tl!/i18n text.
  • Tests cover both signs (lossy-free input, no notice needed), as the "Test both ways" rule asks. No data is dropped, so no notice is required.

Prior concern left alone (1)

  • The thread asking for a path where negatives reach these formatters is still open. The author's reply cites hypothetical downstream uses. I checked every caller: render/src/text.rs:925 and the ribbon/label/workspace/mapview callers pass non-negative values. The label distance range is validated to be positive in crates/engine/src/cmd/labels.rs (limit()), and no apps/ code uses these formatters. So the change is defensive for the public API only. I did not repost this; it is context, not a new finding.

Change size

Compared with main (merge base 5f9daf1 to PR head 337358b).

Files changed Added Modified Removed Renamed Size before Size after Total change
2 0 2 0 0 43.7 KB 45.3 KB +1.6 KB
Path Size before Size after Size change
crates/geom/src/lib.rs 40.4 KB 41.2 KB +830 B
crates/ui-egui/src/measure_units.rs 3.3 KB 4.1 KB +784 B

Display '> -0.1 mm' for negative distances smaller than half a millimetre to preserve sign symmetrically with positive '< 0.1 mm'.

Signed-off-by: Talha Shafeeq <talha.shafeeq.ts@gmail.com>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Code review

Verdict: no bugs or regressions found. The change is small, sign-symmetric, and matches the existing mm/cm handling. I posted no inline comments, since nothing here needs a fix. I read the diff, both changed files, and the callers. I did not run the test suite, since this review had no shell.

Bugs

  • None found. The checks I made:
    • m.abs().round() matches the positive path exactly, so the thresholds are symmetric.
    • Boundaries: -999.6 m gives -1.0 km, -99.96 km gives -100 km, and -999999.6 m² gives -1.0 km².
    • The sub-millimetre negative case now returns > -0.1 mm, which is the fix in f4613ec. I confirmed it at crates/geom/src/lib.rs:432-433 and in the test at line 771.
    • The imperial thresholds in measure_units.rs are symmetric.
    • No new unwrap, panic, or indexing.
    • Confidence: high.

Security

  • None. The change only touches display formatting and adds no input handling or I/O.

Performance

  • None. The change adds only comparisons and abs() calls.

Quality

  • Sign on zero (low severity, pre-existing): format_area(-0.3) returns "-0 m²", and format_distance(-0.0) returns "-0 m". The old code produced the same output, so this is not a regression. The sub-mm arm already handles sign on zero, so the metric area path is the odd one out. Confidence: high on the behaviour, low on impact. I'd leave it for the release quality pass.
  • Test placement (nit): the negative assertions in measure_units.rs sit inside nonfinite_measurements_are_unavailable_in_both_unit_systems, whose name no longer describes everything it checks. Also for the release quality pass.
  • Float round-trip (nit, low risk): the -0.1 * METRES_PER_FOOT tests depend on (0.1·f)/f round-tripping to exactly 0.1 so that whole_or_small picks two significant figures. The PR says these tests pass, so I'm not raising this as a finding.

AGENTS.md

  • Compliant with the rules I checked. No panics, no unsafe, and measure_units.rs uses i18n::fmt. The new strings in geom are English literals, matching the existing < 0.1 mm, and geom sits below the translation layer. Nothing is silently dropped, and no dependencies changed.

Earlier review threads

  • I left 2 earlier concerns alone:
    • The sub-millimetre sign issue. It is already fixed in f4613ec.
    • The reachability question at crates/geom/src/lib.rs:442. The author's reply argues for the public API but names no in-repo path. My audit found none: the label range rejects non-positive values (crates/engine/src/cmd/labels.rs:386), the scale bar comes from nice_distance, which is always positive, and the measure-tool area is non-negative (crates/geom/src/lib.rs:390). The linked issue [Bug]: Negative distance and area measurements never scale to larger units (km, km², mi, acres) #1284's path is still unidentified, so the author should name it or say the change is defensive.

Change size

Compared: the whole PR against main (merge base 5f9daf1 to PR head f4613ec). Sizes use 1 KB = 1024 B.

Measure Value
Files changed 2 (0 added, 2 modified, 0 removed, 0 renamed)
Size before 43.7 KB
Size after 45.4 KB
Total size change +1.7 KB
Path Before After Change
crates/geom/src/lib.rs 40.4 KB 41.3 KB +994 B
crates/ui-egui/src/measure_units.rs 3.3 KB 4.1 KB +784 B

@TalhaHunter101

TalhaHunter101 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

To clarify and close out the reachability question: yes, this change is defensive at the rustgis_geom and rustgis_ui_egui library boundaries. While current interactive map measurement tools only produce non-negative magnitudes, these public formatting functions are part of the core library API and Python bindings, so handling negative quantities symmetrically with correct unit promotion prevents unexpected fallthrough (e.g. -12500 m instead of -12.5 km) in any downstream/plugin use.

@deniial00
deniial00 merged commit 8fdd28f into opengeos:main Nov 1, 2026
20 checks passed
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.

[Bug]: Negative distance and area measurements never scale to larger units (km, km², mi, acres)

2 participants