Question

How to Subtract Polygon value from DEM Raster and create Filled Contours


Badge +3

Looking at migrating one of my clunky ArcGIS scripts over to FME but is betraying my lack of experience with Raster Transformers!

It's somewhat straightforward I think, I just am looking for what the key Transformers are for the 2 following Steps:

  1. Subtract from a DEM Raster's Cell values the values in overlaying Polygons
  2. Build "Filled" Contours (ie. Polygons that contain Cell elevation values within certain range intervals)

Use case is water pressure contour generation. Hydraulically this is the imaginary Hydraulic Grade Line which at most times of the day is almost a flat surface (Hence the 2D polygons with an HGL attribute value) and subtracting the local Elevation from that (from the DEM) derives the local Water Supply Pressure.

My ArcGIS process migrating from builds a second Raster out of the Polygons, and uses that in a Raster Subtract ArcGIS Geoprocessing Tool to create a 3rd raster with the Delta Cell values, and then create Filled Contours from that, but I suspect in FME the Workflow would be a little different and maybe more efficient?


5 replies

Badge

Hi @bwn

Hopefully we can provide some info to help you get started.

There are a few transformers which may help RasterCellValueCalculator and RasterExpressionEvaluator.

This tutorial series will also https://knowledge.safe.com/articles/609/raster-tutorial.html

Could you elaborate a little further on the overlapping Polygons I am a little unsure what you mean by this?

This will hopefully get you started, hope to hear from you soon regarding the polygons.

Regards,

Daragh

Badge +3

Hi @bwn

Hopefully we can provide some info to help you get started.

There are a few transformers which may help RasterCellValueCalculator and RasterExpressionEvaluator.

This tutorial series will also https://knowledge.safe.com/articles/609/raster-tutorial.html

Could you elaborate a little further on the overlapping Polygons I am a little unsure what you mean by this?

This will hopefully get you started, hope to hear from you soon regarding the polygons.

Regards,

Daragh

@daraghbroderick Diagramatically the problem looks like this:

Badge +3

Hi @bwn

Hopefully we can provide some info to help you get started.

There are a few transformers which may help RasterCellValueCalculator and RasterExpressionEvaluator.

This tutorial series will also https://knowledge.safe.com/articles/609/raster-tutorial.html

Could you elaborate a little further on the overlapping Polygons I am a little unsure what you mean by this?

This will hopefully get you started, hope to hear from you soon regarding the polygons.

Regards,

Daragh

OK, looking through the Transformer Library there could be a couple of solutions? But I'm taking only educated guesses hence the question!

The "best" I can see, without actually having used it before is perhaps VectorOnRasterOverlayer? So if I understand it correctly this will create Raster features with new attributes added from the overlaying 2D Polygons, including the Z values from the 2D Polygons, and then from there I'm guessing the delta value can then be calculated by subtracting the original color/elevation value in the input DEM from the new Z value attribute resulting form the overlayer using RasterExpressionEvaluator?

Then to generate filled contours from those new calculated values it appears perhaps ContourGenerator? The documentation isn't really clear that this Transformer can output filled contours, or only contour lines, otherwise I was thinking converting the Raster Cells into polygon squares and then dissolving them into larger filled contour polygons based on their values.......but that could be doing it the very hard way!

Badge +22

You can set a pixel value based on the overlying polygon using the VectorOnRasterOverlayer, but you can't before math algebra directly (like subtracting the value).

 

 

I would take the DEM and use the RasterCellValueReplacer to set everything to 0. Use this "empty" raster with the polygons in the VectorOnRasterOverlayer to create a rasterized version of your polygons with the exact same extents and resolution as your DEM.

 

 

This raster can be used with the original raster with either the RasterCellValueCalculator or the RasterExpressionEvaluator to produce the water pressure raster.

 

 

To generate polygon contours, I would think taking the contour lines from the ContourGenerator along with the boundingbox of the raster (to close the contours at the edges) and an AreaBuilder would probably be the most efficient.
Badge

Hi @bwn.

Thank you for the explanation and the diagram was very helpful.

It sounds like you are on the right track with the VectorOnRasterOverlayer and the RasterExpressionEvaluator I believe parts of this tutorial may be helpful.

https://knowledge.safe.com/articles/1221/elevation-zoning-scenario.html

In terms of the ContourGenerator this tutorial will help with creating the Contours, it does not fill the contours however. I believe the AreaBuilder may be the answer to this.

https://knowledge.safe.com/articles/70433/generate-contour-data-from-raster.html

Let me know if this information was helpful.

Daragh

Reply