Skip to content

Raster stats - #140

Merged
noisyneuron merged 3 commits into
mainfrom
sukanya/raster-stats
Sep 9, 2026
Merged

noisyneuron merged 3 commits into
mainfrom
sukanya/raster-stats

Conversation

@noisyneuron

@noisyneuron noisyneuron commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Add raster statistics methods

Raster layers hold bands rather than attributes, so the existing statistics
methods can't answer anything about them. Four new methods summarize one band
of a raster layer over the whole raster, a bounding box, a polygon, or a line:
a set of statistics, a histogram, counts per distinct value, and values sampled
along a line. Bands on a raster layer now carry the identifier those methods
take, plus a display name.

Ground area is exposed rather than a pixel count, since the pixel count depends
on how far the read was downsampled and the product already calls that number
"Area". Nothing here exposes how the read was budgeted, which stays internal
until the product decides to show users which numbers are approximate.

Handlers are in felt/felt#21889.

Test plan

  1. With this branch linked into the Felt app, open a map with a raster layer and
    run felt.getRasterAggregates({ layerId, band: "band:1", aggregation: { methods: ["min", "max", "area"] } }).
    Observe a value for each requested statistic.
  2. Run the same call with boundary set to a GeoJSON LineString. Observe that it
    throws, naming area as unanswerable for a line boundary.

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@noisyneuron
noisyneuron marked this pull request as ready for review September 9, 2026 17:41

@sullvn sullvn left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks great ✅

@noisyneuron
noisyneuron merged commit 30e756b into main Sep 9, 2026
5 checks passed
@noisyneuron
noisyneuron deleted the sukanya/raster-stats branch September 9, 2026 21:00
noisyneuron added a commit that referenced this pull request Sep 10, 2026
* Raster stats methods

(cherry picked from commit 30e756b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants