Skip to main content
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
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
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
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)
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.

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(Ah0]),1,0)

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.


I'm happy to report that we implemented support for raster lens processing in FME 2018.1 and 2019.0 with the new RasterConvolver transformer.

For more info see these articles:

https://blog.safe.com/2018/07/fme-and-convolution-evangelist176/

https://knowledge.safe.com/articles/74523/neighborhood-functions.html

https://knowledge.safe.com/articles/72616/edge-detection-with-the-rasterconvolver.html

https://knowledge.safe.com/articles/72505/raster-slope-calculations-as-a-rasterconvolver-exa.html


Reply