Skip to content

fix(engine): Identify gives a pixel's values in full - #3543

Merged
Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:fix/identify-exact-values-2761
Dec 1, 2026
Merged

Mavrick-F merged 1 commit into
opengeos:mainfrom
Mavrick-F:fix/identify-exact-values-2761

Conversation

@Mavrick-F

@Mavrick-F Mavrick-F commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

Identify wrote a raster's values the way a legend writes its numbers, so 10602 showed as 11K, 1234.5 as 1234 and 0.0042 as 0.00. It now gives each value in full, as the shortest text that reads back the same f32. A value below 1e-5 or from 1e16 up has an exponent. Legends keep their rounded numbers.

Not changed: values are still the ones the layer holds. A 32-bit integer or 64-bit float that f32 rounds is shown rounded, and a raster read in place or from an overview gives the overview's pixel. Those are separate steps of #2761.

Surfaces: every one that runs identify (desktop, browser, phone, command line, Python, Assistant and MCP), as it changes the command's own answer. No parameter, saved format or undo step changes. Nothing in the repository parses this text.

Testing

  • identify_gives_pixel_values_in_full: fails before the change (["11K", "66K", "1.2M", "0.10", "273", "-0.00", …]) and passes after. The other identify tests pass.
  • Full CI passed on this commit in the fork.

UI evidence

Before After
Identify before: 11K, 8931, 1234, 0.00 Identify after: 10602, 8931, 1234.5, 0.0042

Related issue

Part of #2761.

Summary by CodeRabbit

  • Bug Fixes
    • Raster identification now shows precise pixel values that can be converted back to the same value, including very small and very large numbers.

A raster's values in Identify were written as a legend's numbers are, so
10602 showed as "11K" and 0.004 as "0.00". They are now the shortest text
that reads back the same value. Part of opengeos#2761.
@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Raster identification now formats finite pixel values as text that round-trips to the same f32. It uses decimal notation for zero and values with magnitudes in [1e-5, 1e16), and exponent notation for other values. Missing values remain "NoData".

Changes: Raster identify pixel formatting

Layer / File(s) Summary
Format raster identify values
crates/engine/src/cmd/raster.rs
A new formatter selects decimal or exponent notation for pixel values. Raster identify uses it for band values and retains "NoData" for missing values. A test covers representative positive, negative, fractional, zero, and extreme Float32 values.

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

Change: Bug fix

Suggested reviewers: elpidioassinaturas, pick2510, giswqs

Merge Risk: Minimal · up to b6986

Identify now shows pixel values at full precision instead of rounded legend text. No merge-blocking risk was found in the supplied change.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: Identify now shows a pixel's values in full instead of rounded legend-style text. It follows the fix(engine) convention and matches the raw summary and objectives. It …
Description check Passed The description covers the Summary (what changes and why, with the scope limits), Testing (a named failing-then-passing test and CI status), and UI evidence (before/after screenshots, as the template …
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 the main change: Identify now shows a pixel's values in full instead of rounded legend-style text. It follows the fix(engine) convention and matches the raw summary and objectives. It is specific and does not include a file list or vague terms.

Full details: Description check

Explanation

The description covers the Summary (what changes and why, with the scope limits), Testing (a named failing-then-passing test and CI status), and UI evidence (before/after screenshots, as the template requires for visible changes). The Related issue section links Part of #2761. The template's HTML comments were replaced with real content, so the structure is complete.

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 reads each pixel’s trace
And prints its value with matching grace
Small numbers wear an exponent hat
Zero stays neat, just where it sat
“NoData” keeps its proper place
Then hops away at a steady pace

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: 2bf440dd-7de2-4439-a196-3439db009ba9
Commits

Reviewing files that changed from the base of the PR and between 5799813 and b6986fc.

Files selected for processing: 1

  • crates/engine/src/cmd/raster.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 on lines +1809 to +1811
/// A pixel's value in full, as the shortest text that reads back the same `f32`: not a legend's
/// rounded number, which gave 10602 as "11K" (#2761). One too large or too small to read as plain
/// digits has an exponent.

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 doc says the text is the value "in full", and the title says the same. For a 32-bit integer or 64-bit float band the value was already rounded to f32 when the raster was read, so that is the value shown: for example 123456789 on an Int32 band shows as 123456790. The reader already reports that rounding (r.rounded), and the PR body says so, so nothing is lost silently here. The doc should still say "the layer's f32 value in full" so it doesn't promise more. The (#2761) and "11K" references describe the old output, not this code, so they belong in the PR, not in the function's doc.

Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed on the wording: "the layer's f32 value in full", without the old output. Left for the release quality pass.

/// Identify gives each band's value in full, whatever its size (#2761).
#[test]
fn identify_gives_pixel_values_in_full() {
let values = [10_602.0, 65_535.0, 1_234_567.0, 0.1, 273.153, -0.004, 0.0, 1e-30, -3.4e38];

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 test covers the exponent form only at 1e-30 and -3.4e38, and the plain form only in the middle of the range. The two thresholds that pick the form, 1e-5 (plain from there up) and 1e16 (exponent from there up), are not pinned. Adding 1e-5 (expected "0.00001") and 1e-6 (expected "1e-6") and 1e16 (expected "1e16") to values would cover both edges cheaply. Category: quality

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed: 1e-5, 1e-6 and 1e16 would pin both edges. Left for the release quality pass.

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

This PR changes one function, pixel_text in crates/engine/src/cmd/raster.rs, and uses it in pixels_at. Identify now shows raster band values as the shortest f32 text instead of legend-rounded numbers (10602 instead of 11K). I found no bugs, crash paths, security issues or performance problems.

Bugs

None found.

  • NaN and infinity: Raster::value returns None for non-finite values (is_valid requires is_finite), so pixel_text never receives them and "NaN"/"inf" text can't appear. Confidence: high.
  • Output length: values at 1e16 and above, or below 1e-5, use exponent form, so the output length is bounded. Confidence: high.
  • Surfaces: pixels_at feeds both identify and the popup in select.rs:404, so both show the new text. The imagery profile (imagery.rs:1378) emits raw numbers and is unchanged. Legends still use fmt_num. Confidence: high.

Security

None found.

Performance

None found. One small String allocation per band per identify call.

Quality

  • Doc comment (raster.rs:1809): "in full" overstates the result for 32-bit integer and 64-bit float bands, which are already rounded to f32 when read. The PR body acknowledges this, and the reader's existing rounding notice covers the read. The comment should also drop the issue-history references, which describe the old output. Confidence: high.
  • Test boundaries (raster.rs:1872): the 1e-5 and 1e16 thresholds that choose the exponent form are not pinned by the test. Confidence: high.

AGENTS.md

No rule broken. The change adds no command or parameter (so command-surface.txt is unaffected), no saved format, no layer copies, and no I/O. The test uses unwrap, which clippy.toml allows in tests. The PR body covers the surfaces it reaches.

Earlier review threads

None on this PR, so I left none alone.

Change size

Compared with main (merge base def6c67 to PR head b6986fc), the whole PR.

Files changed Count
Total 1
Added 0
Modified 1
Removed 0
Renamed 0
Size before 99.0 KB
Size after 100.3 KB
Total size change +1.4 KB
Path Before After Change
crates/engine/src/cmd/raster.rs 99.0 KB 100.3 KB +1.4 KB

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3543/
Web app https://preview.rustgis.app/pr-3543/app/
Commit b6986fc

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

@Mavrick-F
Mavrick-F added this pull request to the merge queue Dec 1, 2026
Merged via the queue into opengeos:main with commit c74dbbf Dec 1, 2026
28 checks passed
@Mavrick-F
Mavrick-F deleted the fix/identify-exact-values-2761 branch December 1, 2026 16:19
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