Skip to main content
I'm looking for some transformer that would help me calculate the area of each raster value.

 

 

I tried vectorizing it using "RasterToPolygonCoercer" and then using "Area Calculator" and "Statistics Calculator", but it takes too long because there are many rasters and they're quite big.

 

 

Is there any other approach I could use?
Hi, the boundingboxreplacer (orientated) is what you need, should be v quick. for non uniform size rasters it will be necessary to use a no data setter, raster expression evaluator then raster to polygon coercer
Hi Owen, thanks for your fast response! I've had a look at the boundingboxreplacer but I'm not sure how it can help me. Maybe I wasn't clear enough in my question :/

 

 

Given a raster file that contains values between 1 and 100, for example, I need to know how much area each of the values occupies. I know the area of each raster cell, so if I knew how many cell per each value are present, it should be easy, but i'm not sure how to get there with FME.
Hi,

 

 

As far as I know, there isn't a very fast way to count the number of cells grouped by each pixel value. The RasterCellCoercer could be relatively faster than the RasterToPolygonCoercer.

 

 

Takashi
Ah I see, sorry. You could speed it up by using a rastercellrounder first
Hi

 

 

Yes, try the RasterCellCoercer and convert to points. That should be a bit faster than converting to polygons. Then count the number of points per value and multiply by the area of the raster cell size.

 

 

David
As you know the area of each cell all you need to do is extract a map of the values...

 

This boils down to creating a table.

 

Then u can use statistics/aggreagtion/list techniques to assemble the total area.

 

 

If you need to know the area of cells of same value wich are adjacent to one or more, things get a bit more complicated of course.

 

But the data in tabular form can be effctively queried for just this.

 

 

If the areas have unique pixel values then the rasterextentscoercer set to data extents in teh extents type dialog and then an area calculator should do what you need - this is a lot quicker then the other coercers that vectorise each raster cell. If you don't change the 'extents type' it will give you a polygon of the entire image.

If its more of a scanned map then this probably wont work.


Hi Owen, thanks for your fast response! I've had a look at the boundingboxreplacer but I'm not sure how it can help me. Maybe I wasn't clear enough in my question :/

 

 

Given a raster file that contains values between 1 and 100, for example, I need to know how much area each of the values occupies. I know the area of each raster cell, so if I knew how many cell per each value are present, it should be easy, but i'm not sure how to get there with FME.

In case anyone bumps into this just like I did, coercing the raster into a pointcloud (geometrycoercer) massively increases the speed.

The pixel value becomes the Z-component. This makes it possible to split the pointcloud and extract the amount of points per rastervalue. Use a PointcloudPropertyExtractor: _num_points. Eac point represents one rastercell.


Reply