Here’s a 5-chapter tutorial on the new QGis feature in version 3.26: elevation profiles.
Chapter 5: Profiles in QField
Chapter 5-1: Profiles in QField – Projects without a raster DTM layer
The data required for this tutorial is available here.
The versions used are QGis version 3.30.3 and QField version 2.8.2.
No special layers are required to create a topographic profile with QField. All projects loaded on your mobile device can be used to create them.
QField’s PROFILE tool
To display a profile on your device, open the menu:
In the menu, click on the Parameters icon
From the drop-down menu, select Measurement tool
The measurement tool is now active, and the Profile icon can be used to activate or deactivate the display of a profile.
To display a profile, you need to enter a starting point for the profile. Move the map to place the central target on the desired point, then click on the Add Point icon.
Move the map to place the target on the end point of the profile, click on add point. The corresponding profile will be displayed.
The profile is built using QField’s default elevation layer, MAPZEN Global Terrain. It always appears in gray. Even if you have project-specific terrain layers, you will have this display upside down by default. There is no option in QField to disable this display, but you can override it in the QGis project. We’ll see how to do this in the second part of this chapter.
The two types of QGis project
There are two types of QGis project for topographic profiles.
- Projects in which we assume that all our layers will be represented on flat terrain, with an elevation of 0m.
- Projects in which we define a digital terrain reference model and the layers will be displayed on the basis of the elevations contained in this model.
To define the type of project we’re going to use, go to Project->Properties->Terrain tab.
You have the choice of terrain type. The first corresponds to a flat terrain with a height of 0m, while the other two options are based on a raster DTM or an irregular mesh DTM (TIN, for example).
Let’s take a look at a project of the first type, with terrain defined as flat.
Possible layer types
There are five types of layer that can be used for QField profiles. Each of these needs to be configured for appropriate use. In particular, in the Layer Properties window, in the Terrain tab, there are two parameters that need to be properly configured for the layer to be displayed correctly on the profile:
- Elevation restriction
The terms used are not always very clear. Let’s take a closer look.
The elevation restriction determines how the elevation of the layer in the profile is calculated. There are three choices:
Fixed to terrain: Regardless of whether the layer contains Z values in its geometry, the height used to display entities on the profile will be that of the project’s terrain elevation at that point. Entities will be “draped” over the terrain model.
Terrain-relative: Z-values of feature geometries will be added to the terrain elevation at that point.
Absolute: whatever the elevation of the terrain at the location, the height assigned to the entities will be that contained in the Z of the geometries.
The Offset is an elevation value that will be added to the elevation resulting from the elevation restriction for the display of entities. It is defined either by a constant, an attribute or an expression.
1- 3D terrain vector layers
These are layers with XYZ geometries containing terrain elevations. In our example, this corresponds to contour lines every meter.
Parameter settings in the layer properties must be
Elevation restriction: ABSOLUTE
In practice, for your QGis project it doesn’t matter whether you select ABSOLU or Relative to terrain. In the first case, the Z values of the geometries will be used, and the height of the terrain will be ignored. In the second case, the Z values present in the geometries will be added to the height of the terrain, which for this project is 0m. In both cases, we obtain the same value.
In QField, however, the terrain height is never 0, since QField uses MAPZEN by default. We therefore need to use the ABSOLU parameter so that the height is that of the geometries. Otherwise, the height will be the sum of the Z value and the height of the point in MAPZEN.
The offset must remain at 0, as this will be our reference layer for the profile, and an offset would make no sense.
2- 3D vector layers other than terrain
In our example, this corresponds to building layers or road sections, with geometries containing the altitude of each entity.
Same comment as above.
Elevation restriction: ABSOLUTE
If this is not the case, entities will be displayed at a height resulting from the addition of their Z plus the MAPZEN terrain height.
3- 2D vector layers + Z
The geometries of this type of layer do not contain a Z value. However, in the attribute table, there is a field containing the entity’s altitude. In our example, this corresponds to the curve_1m layer, with contour lines in the form of 2D polylines, but with an ALTITUDE field present in the attribute table.
The appropriate configuration for this type of layer in QGis is:
Elevation restriction: Fixed to terrain
Since there are no Z values in geometries, ignoring them ensures that there will be no interpretation or calculation problems.
The Offset feature comes into its own here, as using the value of the ALTITUDE field will display entities at the height of the attribute field.
4- 2D vector layers
These are classic vector layers, with no Z value in the geometry, and no attribute field with entity altitude data. In our example, this corresponds to the “hedges” and “watercourses” layers.
For vector layers, QField only uses the Z values contained in the geometries. At least up to the current version at the time of writing (2.8). As long as there is no Z in the geometry, the layer is simply ignored for profiles.
While these layers can cause problems in QGis by extending the Z axis of profiles, they have no effect on profiles generated in QField.
Indeed, in QGis projects, as soon as the profile line intercepts a 2D entity, if the offset is not set up, the Z axis will start at 0.
Take a look at the following image
Now, if we move the profile line slightly so that it intercepts a hedge (2D layer), the result will be as follows:
In QField, even if hedges appear in the map window, and the profile line intercepts them, as the layer is ignored, the Z axis will not be affected.
5- DTM raster layers
To add raster layers to QGis and QField profiles, simply open the raster layer properties, and in the Terrain tab, check the box labeled Represents surface elevation.
On the other hand, if you obtain a profile like this in QGis
You’ll get a result like this in QField
QField will insist on displaying the MAPZEN profile in the foreground. In the second part of this chapter, we’ll look at how to replace the MAPZEN profile with our raster layer.