I'm trying to figure out a way to map water depth data from a coarse triangular mesh cell onto a high resolution (HR) raster (in .asc format). My coarse model and the raster are 2D.

I created a very coarse (<-- intended) mesh for an urban flooding simulation by polygonizing a high resolution digital elevation model, smoothening the edges (using QGIS) and then meshing it (using gmsh).

Then I did the flooding simulation and now I have some results for the mesh in .vtu format. For each cell I have a water elevation and a bed elevation value (--> substract the latter from the former to get water depth). The water elevation is of course higher than the bed elevation of a cell.

As mentioned the grid is coarse, I have big cells, for example let's say a cell is 100 m in characteristic length. The HR raster is very fine.

In a next step I'd like to get some water depth results (= water elevation - bed elevation). I already have results just for the coarse grid. But now I'd like to take my water elevation value from a coarse cell and the underlying bed elevation data from the HR model and compute the water depth this way.

The following sketch might elaborate my undertaking a little better

enter image description here

I have a couple of problems doing this:

  1. Is this actually the right forum for this kind of task :D? Because I don't know if QGIS is capable of doing this, or if I only need something like ParaView for this task. The raster calculator might come in handy I thought.

  2. If QGIS fits for me, how do I get the .vtu data into QGIS? This would be nice because I could create the water depth for all cells but if it's not possible I'd just replicate a couple of cells as triangles in QGIS and give them the water elevation data by hand.

(I've seen a couple of questions concerning QGIS and VTK that go in the same direction and I will check them out now.)

  1. If all of that should work out, how can I actually compute the water depth? My first thought would be to use the raster calculator to compute the difference between water elevation and bed elevation and create a new raster that has the resulting water depth as information on each raster point.

I've now managed to create a polygon with cell IDs and corresponding water elevations in QGIS. I used a gmsh plugin for QGIS and extracted the elevation data with ParaView into a CSV-File. I then created a table join within QGIs for the Cell IDs and their respective water elevation levels. Now I only need to use the raster calculator. Does anyone have an idea how I could compute the wanted water depth?

  • Are you able to open the VTK in a text editor,if so, could you post an extract of the file? Can you link the coordinates of each cell to a water depth?
    – Kantan
    Commented Nov 9, 2017 at 16:12
  • I edited the post.
    – youngfinn
    Commented Nov 9, 2017 at 17:27
  • I have never worked with .vtu files, but your task is certainly a common task in flood mapping, this is a good place to share your question and you can find many posts about calculating depth and volumes between to rasters in QGIS, GRASS and SAGA. Is .vtu the only output of your software? Which software are you using for the flood calculation?
    – Marco
    Commented Nov 10, 2017 at 8:15
  • I use a software that was developed at our university so you won't know it. Unfortunately my coding skills are not good enough to implement a different output format. ParaView allowed me to save the data as CSV though, maybe I can use that?
    – youngfinn
    Commented Nov 11, 2017 at 9:59
  • @FinnGolovkin did you manage to make it work? If so please mark the question as solved so others will know it's a worthy solution. Else update us on your progresses so we can make it work!
    – Kantan
    Commented Nov 15, 2017 at 7:38

1 Answer 1


Once you imported the georeferenced points in QGIS, the process is actually pretty simple. (according to your edit you managed to get there)

First, you'll need to interpolate your water level. That is easy using either the built-in tool in Qgis or Saga, GRASS, etc. I usually go for the QGIS tool for its simplicity. It is accessible in Raster>Interpolation>Interpolation

In the input panel (left side of the window) you will have to select your points layer and the field you want to interpolate on (your water surface elevation) in the drop down menus, then click add.

In the output panel, select the method (triangulation is usually fine), then either select the number of columns and rows your result will have, OR and that is in my opinion better, define your cell size, accordingly to the cell size of your terrain. That information is available in layer properties, tab metadata.

Select your output file, adding the file extention after the name, so the software recognises it, and process. (leave the extent as is)

You will then get a raster with your water level. The last step is to use the raster calculator (Raster>Raster Calculator) and using the following formula :


This will allow to select only the raster cells where the water is above the terrain, leaving the water depth where it is positive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.