Question

Slicing a raster

  • 15 October 2014
  • 9 replies
  • 8 views

Badge +1
Hi,

 

 

I have a raster where the cell values represent elevation values.  I want to intersect the raster with a horizontal plane that has a uniform elevation, and then calulate the volume of the gap between the plane and the raster surface.

 

 

I have no idea what sort of transformers I need to do this and whether I need to convert the raster to some sort of surface, etc...

 

 

Any help would be greatly appreciated.

 

 

Thanks

 


9 replies

Badge +3
Hi,

 

 

You could create another raster with the same extent (rasterextentcoercer would be good for that) and set (all) its z values to the horizontal elevation you need.

 

Then use rasterexpressionevaluator to calculate the difference per cell.

 

 

Or you could use a RasterSingularCellValueCalculator to do that too.

 

 

You can then calculate the volume per rastercell and sum those. (that would be an approximation with the rastercellsize as resolution)
Userlevel 2
Badge +17
Hi,

 

 

I would try this. Basic concept is common to Gio's suggestion.

 

1) RasterExpressionEvaluator: If a cell value (elevation) is greater than elevation of the question plane, replace the cell value with (cell elevation - plane elevation); otherwise replace it with Nodata value. @if operator can be used.

 

2) RasterToPolygonCoercer: Set "Extract Nodata Values" to "No" (default).

 

3) Calculate volume = _label * area for each reaultant polygon, and then sum the volumes.

 

RasterCellCoercer can also be used instead of RasterToPolygonCoercer, but I'm not sure which is more efficient.

 

If Nodata was not defined for the raster, set Nodata value with RasterBandNodataSetter, beforehand.

 

Hope this helps.

 

 

Takashi
Badge +1
Thanks Takashi and Gio.  I tried Takashi's method and got a volume result.  Then I compared it to my own method that is quite similar, but got a different volume result. 

 

 

With my method I used RasterSingularCellValueCalculator with a * operator and Numeric Value set to the cell area.  Then used RasterCellCoercer and extracted the Z value and added all the Z values up.    Whereas in Takashi's method I used RasterToPolygonCoercer and multiplied the _label result by the cell area and then added all the _result values up.

 

 

In theory, shouldn't this give me the same answer?

 

Badge +1
Ah I think I know where the problem lies.  Does RastertoPolygonCoercer output all the polygons with the same value as a merged polygon?  If so, then when I multiply that polygon value by the cell area, this wouldn't work, as I wouldn't know what the cell area is of the contiguous polygons!

 

Userlevel 2
Badge +17
Logically there should not be difference except slight computational error, I think.

 

Check these points.

 

Nodata cells were excluded when calculating?

 

Distance unit in the coordinate system of the raster is equal to the unit of elevation?
Userlevel 2
Badge +17
Yup, adjacent cells having same value will be merged by the transformer ;)
Badge +3
Because of averaging of larger areas, it is best do do the calculation on cell level.

 

Its like aproximation math, integration. With smallest unit the cellsize. Therefore i would not use raster to poly conversion.

 

Cell area multiplied by heigtdifference and add em all up.
Userlevel 2
Badge +17
Gio, I do not think so. FME @Area function seems to calculate area of a geometry without any approximation, as exactly as possible regardless of its size or complexity. At least in my experiences, I've never seen any difference between the sum of areas of individual geometries and the area of a geometry created by merging them, except a slight computational error.

 

The RastertoPolygonCoercer merges only cells that have same value, so there is no reason for bringing any difference from the result of summing individual cells, I think.

 

Of course there has to be a consideration about the difference in efficiency among different approaches, but it's another matter.
Badge +3
That would depend on the resolution vs intrensic value of the data, would it not?

 

 

If say  1 represents a very large number, rounding of 0.0001 could still be significant difference.

 

You would certainly not do this if it was your bankaccount with unit value of 1 billion.

 

 

And as there is no need to coerce to geometry (wich is timeconsuming) for htis calculation, i would not pollycoerce.

Reply