Skip to main content
Question

Zonal Statistics alternative (Raster Analysis)


Hello,

 

I have just started doing a bit of raster analysis in FME and was wondering if there was an alternative to the zonal statistics tool in ArcGIS? I have a raster grid containing landuse areas and need to sum them up to calculate total area, a tool to sum an entire raster (minus nodata values) would also do the job.

 

Thanks very much,

 

Ed

7 replies

david_r
Celebrity
  • May 1, 2014
Hi,

 

 

there are probably many ways to do this, but a starting point might be to convert the raster cell values to polygons using the RasterCellCoercer. Depending on your raster, you cold then group different cell values into landuse types and then use the Dissolver with a Group By on the landuse type to generate polygons for the AreaCalculator, etc.

 

 

You could also use the RasterCellCoercer to output points and then use the StatisticsCalculator on those.

 

 

David

takashi
Influencer
  • May 1, 2014
Hi,

 

 

I agree with David, there should be several ways. If your purpose is just to calculate area for each landuse category, the RasterToPolygonCoercer and AreaCalculator could also be a solution. Although there is not exact same tool as the zonal statistics tool of ArcGIS, equivalent processing can be performed easily with some transformers in FME.

 

 

Digression. I feel processing by the RasterCellCoercer in FME 2014 is much faster than previous version. I think a great improvement has been done.

 

 

Takashi

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 13, 2014
Would'nt that be like timewasting, to first rcc them? or is there an advatage to that, is it faster then stick to rasters?

 

AS you can extract grid size, you might as wel sum gridsizes after sorting the rastervalues representing the relevant zones.

 

 

There are plenty rasterbased transformers to do that. ( and examples to do that roaming the net)

helmoet
Forum|alt.badge.img+8
  • April 15, 2016
Hi @Ed, I had a similar question, which I handled this way: Use RasterExpressionEvaluator to isolate a specific category in the raster. E.g., I was interested in the amount of nodata in the raster, so I used the expression IF (A[0] > 99999.0, 1, 0) to set nodata value to a value of 1 and all other data to a value of 0. After that I used a PointCloudCombiner to generate a pointcloud from the raster (point interval 1.0). Finally I used a PointCloudStatisticsCalculator to sum all z component values of the pointcloud. Since all values I was not interested in are zero, they don't contribute to the total sum. If you used a RasterPropertyExtractor to extract information on the raster, you can use that info to computer the area you're interested in. Like: total_area = sum(z) x spacing_x x spacing_y And so for any raster category you might be interested in.

takashi
Influencer
  • April 15, 2016

Hi @helmoet, although it's not documented, in the current RasterExpressionEvaluator, there are cases where the expression always returns Nodata if different interpretation values are used in it (e.g. real64 and uint8, etc.). I guess that it's the reason why you cannot get your expected result. Try using the @isnodata function, instead of the > operator. e.g.

@if(@isnodata(A[0]),1,0)

deanatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • June 15, 2017

For zonal raster statistics you might also be interested the RasterStatisticsCalculator on FMEHub. This is based on the PointCloudStatisticsCalculator. Since both are array based they are both very fast compared to any vector based process. Also, don't forget that as of FME 2017 RasterMosaicker has stats options for overlapping data values and the incoming rasters do not have to align. This includes all the typical operations like sum, mean, min, max etc.


deanatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • February 14, 2019

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