Skip to main content
Released

Spatial Statistics on Raster Data

Related products:Integrations

Easy way to calculate statistics of rasters within polygon area's. Basic stats like min, mean and average of pixel values.

12 replies

jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • January 14, 2016

A few years ago I created a ZonalStatistics custom transformer. I can't share it here, but the basic workflow was

  • clip the raster(s) by the polygons (which had a Zone Id)
  • PointCloudCombiner (grouped on Zone Id)
  • PointCloudCoercer (Individual Points)
  • CoordinateExtractor (Z value)
  • StatisticsCalculator
  • FeatureMerger back to the polygons

Coercing a Raster to a PointCloud was (and probably still is) orders of magnitude faster than using the RasterCellCoercer.


david_r
Evangelist
  • January 15, 2016

I can confirm that the RasterCellCoercer isn't very fast at all. Great idea to coerce the raster into a point cloud, thanks for the tip!


Forum|alt.badge.img
  • June 1, 2018
And add histogram too

 

 


fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • June 2, 2018
How would you like the histogram output? One feature (row) per pixel value, having the pixel value, the band #, and the count?

 

 


fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • June 2, 2018

Note that FME 2018.1 has a RasterStatisticsCalculator that will do the calculation for a whole raster. You'd still have to clip as per @jdh above, but the next 5 steps are replaced by just the RasterStatisticsCalculator.


jdh
Contributor
Forum|alt.badge.img+28
  • Contributor
  • June 4, 2018
Histogram would be awesome. My RasterHistogrammer custom transformer creates a compound list on the original raster

 

_band{}.histogram{}.value

 

_band{}.histogram{}.count

 

 

I think matching the statisticsCalculator format of [list name]{}.count|value as close as possible would be the way to go.

 

so maybe [list name]{}.band{}.value

 


maayke
Contributor
Forum|alt.badge.img+6
  • Contributor
  • June 8, 2018
The RasterStatisticsCalculator sounded very promising at first for this purpose, but when the polygon dataset I'm working with is very large, the transformer isn't working well for me. It would be really great to see an equivalent of Zonal Statistics in FME in a future version!

fmelizard
Contributor
Forum|alt.badge.img+17
  • Contributor
  • June 11, 2018
Would you mind sending your polygon dataset in to support@safe.com -- when you say it is large, do you mean you have a large #of polygons, or a few polygons that are large in size?

 

 


maayke
Contributor
Forum|alt.badge.img+6
  • Contributor
  • September 10, 2018

 

Hi @daleatsafe - thank you for your response and I'm sorry for the late reply. At the time we used QGIS instead, but now, a few months later, the problem reoccurred. I meant a large number of polygons! I've sent a sample of the data to the support team.

Forum|alt.badge.img
  • October 24, 2019

Hi, it's also needed to have a histogram functionality for both rasterstatistics and pointcloudstatistics!

 

 

For example, a pointcloud of where z component has to be ranged according to Count of unique z values should be easy to add. Its already possible to filter/range according to any Component, so the idea would simply be to come up with a solution for finding unique values within the pc component's

john_gis4
Contributor
Forum|alt.badge.img+13
  • Contributor
  • March 15, 2021

I am also looking for a way to get counts of cell values in a given raster (or better still a zone of a raster defined by a polygon or other raster).

For example, I have 3 values representing terrain categories in the source raster. For each polygon I need to find the count of cells for each category. This would be pretty straightforward in ArcGIS Spatial Analyst, but have struggled to find a way to do it in FME.

I would have thought it's just an extension to the RasterStatisticsCalculator to optionally output a list of cell values and their count.


LizAtSafe
Safer
Forum|alt.badge.img+15
  • Safer
  • February 12, 2025
OpenReleased

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings