Interpolating point data to create a bathymetry map using QGIS3

Rosalie Bruel
March 23rd, 2019

Content - Get QGIS - 1. Get your data - 2. Upload your data to QGIS - 3. (Optional) Transform your data - 4. TIN Interpolation - 5. Delimitation to the correct area - 6. Visualise the different elevations - 7. Generate contour lines - 8. Add the labels - Source


Every 1.5 years or so, I need to get the bathymetry for a lake. While these files probably exist somewhere, it’s sometimes hard to find them, while XYZ files are commonly shared. Instead of chasing the bathymetry file, I rather then create it. My thanks to Raul Serbán who showed me how to do it for the first time in 2014. Seeing someone else doing it gave me the confidence to try on my own. And I promise – it’s not that bad.

I had the steps on how to do it on QGIS v2 documented in a .doc file, but I recently upgraded to QGIS v3, and I could no longer follow my instructions. As I went through on how to do it, I used a combination of help online (mainly this for previous QGIS versions), but did not find a comprehensive Tutorial.

This tutorial is for QGIS 3.4.5-Madeira, Python 3.6, using macOS 10.14.3.

Get QGIS

  • Download QGIS 3
  • Depending on your use, I recommend choosing the long-term release. The latest release is richer in features, but might be less stable.
  • You’ll have to download Python as well.

1. Get your data

This tutorial allow you to generate a bathymetry using XYZ data. Have them saved in a .csv file. If you don’t have any data, you can follow these steps using Lake Champlain data. Download the spreadsheet data from here.

Lake Champlain bathymetry dataset follows this format:

X Y OBJECTID DEPTH_FT
432477.13 277957.69 1 -1
432661.78 277955.88 2 -1
432784.13 277910.97 3 -10
432965.75 277910.31 4 -23
433294.03 277635.31 5 -9
433180.28 277624.09 6 -6

You’ll also need the lake contour (a .shp file). There are some data bases by regions (e.g., CORINE Land Cover for Europe). I’ll update this section if I learned about a global database.

2. Upload your data to QGIS

Click then in the top-left corner of the QGIS window to open the data source manager.
We’ll be using ‘Delimited Text’ to import our data.

Select the path to your file in the ‘File name’ field. You may customize the name of the new layer you’re about to create in the field below. QGIS 3 support several input format – choose yours in the ‘File Format’ section. Select which column cary your longitude and latitude (X and Y) information in the ‘Geometry Definition’. Make sure the projection (Geometry CRS) correspond to those of your data.

At all time, you can use the ‘Sample Data’ preview to make sure your imported data look good. When you’re done, click ‘Add’.

You created a new layer, that appears in the bottom left pannel. If you zoom in, you’ll see it’s made of several points. You can get more information on each point by using the Identify Features option .

3. (Optional) Transform your data

Remember, our depth are given in feet. I want to convert them in meters because the system makes so much more sense so the data can be directly used in future publications. We can do that directly in QGIS.

Open the field calculator by clicking on the following icon: . Here, we want to create a new field, so we’re filling out the left side. We will call our depth in meters Z. In order to be sure we write the equation correctly, we can use the drop-down menu in the middle. In the ‘Fields and values’ category, you’ll find the existing fields. Double-click on the current depth, and it will appear in the left window. We then only have to convert it in meters using the relation 1 foot = 0.3048 meter.

If you use the ‘Identify Features’ option described in the previous section, you will see that a new value is available for each point. Another way to visualise is to open the attribute table, using .

4. TIN Interpolation

From Ujaval Gandhi post:
Interpolation results can vary significantly based on the method and parameters you choose. QGIS interpolation supports Triagulated Irregular Network (TIN) and Inverse Distance Weighting (IDW) methods for interpolation. TIN method is commonly used for elevation data whereas IDW method is used for interpolating other types of data such as mineral concentrations, populations etc.

Before anything, unzoom to cover the extent of your data – this will be useful in a minute. You can do that by clicking on .

In order to create a bathymetry, we need to interpolate between each discrete data to get a continuous information. This is one of the big differences between QGIS v2, where the interpolation was accessible through a plugin, and QGIS v3, where interpolations methods are implemented.

Select Processing / Toolbox / Interpolation / TIN Interpolation.

Here, you need to select the layer you just uploaded (the .csv file). In the ‘Interpolation attribute’, select the column where depth is given. Make sure to add this layer by clicking on the + sign. For the extent of your interpolation, select ‘Use Canvas Extent’ (this is why we unzoomed earlier). Choose a pixel resolution. My default is 0.10000 (shown in the print screen below), but this would take way too long for a large lake such as Lake Champlain (and I don’t need that precision). I change this value to 10, but feel free to change this value depending on your system / your computer power. Finally, name and give a location to save your output in the ‘Interpolated’ field. Click ‘Run’.

You just created your new TIN layer.

5. Delimitation to the correct area

When trying to do this next step for the message, I got an error. Apparently, it’s an issue with QGIS 3 on Macs, and I found the solution to the problem here. Basically, you need to add a path to your system environment.

Pasting here the solution in case the discussion disappear… Go to Settings … Options… System … Environment Enable “Use Custom Variables” First select “Prepend”, under variable enter “PATH”, under value enter “/Library/Frameworks/GDAL.framework/Programs:/Library/Frameworks/Python.framework/Versions/3.6/bin:” (all these without the quotes)

Back to the interpolation.

Interpolation does not give accurate results outside the collection area. You need to clip the surface with the lake boundary. Go to Raster / Extraction / Clip raster by mask layer. Here, you have to select your shape file contour of the lake for the Mask layer. Again, make sure to save your output to your files. Click ‘Run’.

6. Visualise the different elevations

A new layer was created. Right-click on it, and got to properties.

In there, select ‘Singleband pseudocolor), and choose a Color ramp. With the ’Mode’ drop-down menu, you can select the number of classes. Click ‘OK’, to get your new visual

7. Generate contour lines

Select the clipped layer (the one we just created), and go to Raster > Extraction > Contour. This window allows you to chose the interval between contour lines (here I have it set to 10) and save your output.

A new layer is created. I did it as well for a 20 interval; the output is shown below, zoomed in onto the Main Lake and Mallet’s Bay.

8. Add the labels

I was about to stop this tutorial here, but went back to the one I’ve been using for QGIS 2 and noticed the author included the label as well – good point! In QGIS 3, the procedure stays the same. Select your contour layer, click right, Properties. Go to Labels, select ‘Single labels’, in the ‘Label with’, select ELEV, and change the placement to curved. Click ‘OK’. Each contour line will be labeled with its depth

Source

At the moment, this tutorial is totally based on the tutorial by Ujaval Gandhi, for previous versions of QGIS. I documented these steps for me at first, and thought I might as well share them, but I’m definitely not a Geograph.

Table of content created using this method.

is loading comments…