In this article we will discuss one of the fundamental questions of drone photogrammetry: how can you take photos on a surface with changing elevation for mapping and 3D modeling purposes? What are these marginally changing fields? Well, they can be for example complex roofs of large buildings, mountainsides, volcano calderas, openpit mines or even a bigger land under terraced farming. There’s one thing I hear a lot: “I want to survey just like any other case. I would fly at a fixed altitude in a simple grid.” But in this case it’s not that simple.
If you want a high quality map that has unified resolution, and the data points of the 3D model to have uniform density, you need to take care of the so-called “GSD” (Ground Sample Distance). If you want this to be as stable as it can, you will need to fly in terrain awareness mode. This means that the flight path of the aircraft parallelly follows the elevation of the surface.
Sidenote: If you have a lot of time and you are willing to plan yourself the GSD for the different altitudes, you can calculate here, and plan the route for the drone. If you choose this method, you have to take care that through surveying, the differences in GSD values should not go above 2. Otherwise, a critical distortion may affect the model and the map. If you don’t want to bother with these difficult techniques, just continue reading.
From this article you can learn how to survey in terrain awareness mode in a time and energy saving way. We will also discuss what tools and devices you’ll need for this extraordinary process. I will explain to you in detail the steps of creating a digital elevation model (DEM) from point data or even paper maps. From these, the drone will calculate and adjust the flying altitude. This will cause the images to be taken in the same relative altitude. This will be a longer chapter, because I will show you lots of lifelike examples. 🙂
Terrain awareness surveying results in large file size orthomosaics, digital elevation models (DEM), vector files (e.g. contour lines), point clouds and 3D models. Sharing these output files with the client is difficult. In any case, it is recommended to use the SurveyTransfer data sharing tool to transfer these files.
I recommend this article for drone pilots who are or will be surveying in extreme conditions. In addition, I think it could be useful for those wanting to expand their knowledge about automated flying solutions.
1. GET THE RIGHT TOOLS
And what are these tools you will need? Here’s the list. I would start with a drone with a GNSS RTK receiver. This is because drones with the normal GNSS can calculate their positions (and their distance from the ground too) much less accurately. In other words: there is a significantly higher chance that your survey will not be accurate enough or even that your equipment will suffer some damage through the mission.
You should check if your UAS (Unmanned Aerial System) supports terrain awareness. Phantom 4 RTK and Matrice 300 RTK by DJI can be bought with DJI Pilot software, which allows them to fly in terrain awareness mode. If you don’t have this opportunity, don’t worry, there are other solutions. There are multiple software that can connect to your drone and are able to control it the right way. In my opinion one of the best software out there for flight planning is DroneHarmony, but you can choose DroneDeploy or one of the lot of other flight path planner applications.
Sidenote: Always check if the chosen software supports your drone and your operating system. If you choose DroneHarmony, you can check it here.
You will need DEM data, for the software to calculate the optimal flight altitude. Always ask the customer (or the land owner) if there is data or even DEM from previous surveys that you can use. In case you have to make the DEM yourself, you will need a GIS software. For this purpose, I recommend QGIS, which is an open source GIS program.
2. IT’S A GOOD BASE TO HAVE A GOOD BASE MAP
Many route planner software can retrieve a surface model with 10-15 meter resolution, from a database that covers the whole Earth. You can even download a ready to use DEM from many databases. Here is a good summary of them.
This sounds promising but let’s examine in detail, what does it mean to have a resolution of 10 meters. A 10 meters DEM is a raster model, which consists of 10×10 meters squares. One pixel means 100 m2 in reality. Inside every single 100 m2 square, we have the same altitude value. From this we can conclude that if we need to survey an object in terrain awareness mode, which is smaller than this, we will need better resolution. What are the other solutions?
2.2 DATA COLLECTION IT 2 PHASES
If you need a more accurate survey, you can make a less accurate one first with fixed altitude. You can create the surface with photogrammetric tools, and you can plan the flight with terrain awareness in a limited area. In the preliminary survey, you don’t need accurate data, it’s enough to have around 1m/px ground resolution. Yeah, I know you don’t want to survey twice only to have the basic data. Let me tell you an alternative for that!
2.3 GIS SUPPORT
Ask for altitude data from the land owners. They usually answer “That’s why we asked you to create the beautiful map!”. But still, you have to make them understand that you are not a wizard who carries high resolution topographical elements under his/her cape. Without proper data, you won’t have the desired result. “Garbage in, garbage out” as you could say. So, in better circumstances they give you a quite usable base map with the area’s older condition, or they even give you a whole DEM. It’s also possible that the data owner has data, but not in the right condition
- There can be point-like data surveyed by classic geodetic tools, usually in DXF or DWG format
- There can be a nice contour line map in PDF format
- There are cases when the only thing you get is a paper map
In the previously mentioned cases our mission becomes interesting. To solve the task, we will need a bit of GIS knowledge. In the following subsections we discuss how you can position a paper map in real location. Then how can you vectorize it, and then how can you merge it with your CAD files (DXF, DWG). At the end we create a digital terrain model.
Georeference is a special process when we endow files without spatial projection or poorly determined in space with real geographic coordinates. These files can be images, pdf files or even vector files. Imagine this, as we assign pixels to coordinates. We do this because the UAV flies based on geographical coordinates. If you want your drone to complete the mission based on your surface model, the X, Y, Z coordinates must be in the correct place.
The most common case when we use georeference is when we scan paper maps and we position them in the right location in space. Of course it’s also conceivable that we need to use a topographical map (which does not have a raw version).
The process can be done in two ways: We give the coordinates of a point with numbers, or we link two clearly visible points (like church towers, crossroads) with elements from another georeferenced map.
Sidenote: I perform this process in QGIS 3.22.1 version. If anything differs from what you see on your side, it’s probably because you use a different version. Check the documentation of QGIS, or contact us if you feel you got stuck. Don’t worry, we will help you.
Open the QGIS. Check if “Georeferencer” is active. If you find the “Georeferencer…” option under the “Raster” point of the menu bar, you can skip the next paragraph.
In case you can’t find “Georeferencer…” under the “Raster” menu, then choose the “Plugins” option, then the “Manage and Install Plugins” option. Then you start to type “Georeferencer…” at the “All” site. If you’ve found it, install it, then get back to the “Raster” menu and finally open the “Georeferencer…”
Add your map, that is to be georeferenced, by using “Open Raster…”. I used a scanned hiking map as an example. After the image has appeared, set the coordinate system with “Raster Properties…” under the “Settings” menu.
Choose the “Source” option from the sidebar, then give the coordinate system or the EPSG code. Do the georeferencing in the same coordinate system as the map was made, we can do the coordinate conversions to WGS84 (which the drone uses) later.
If you don’t have any data to start the georeference with, try to use a base map. Add an OpenStreetMap basemap to the QGIS canvas. When using OpenStreetMap don’t forget that it uses the Pseudo-Mercator coordinate system. Set the QGIS project to the appropriate coordinate system, to be unified. You can do that with “EPSG:3857” in the right bottom corner. Type the name or the EPSG code of the system into the type field.
In OpenStreetMap zoom to the area that you want to examine. In the “Georeferencer” tab, pick a clearly visible point that you can identify on the other map. After selecting the point, you can choose if you want to give the coordinates, or want to choose a point from the map (“From Map Canvas”). Pick the latter one for the example.
Sidenote: If you are georeferencing a map that has a visible coordinate grid, then it’s better to use those values. It’s best to set the reference point in the crosses of the coordinate grid, so you can fill them with coordinates. You can read these from the edge of the map.
After pressing “OK”, you can see that a new GCP (Ground Control Point) appeared under the “Georeferencer”. These are the same GCPs that you have probably already used to refer to other photogrammetric models. Place as many points as possible because this will improve the end result. However, you shouldn’t place your points along the line. Spread them all around the map instead. This helps you to avoid a distorted end result.
If you are done with placing the points, click on “Transformation Settings” in the “Georeferencer” tab. Then set the destination and format of the output and give the target projection (SRS).
After all these you have only one thing left. In the “Georeference” tab click on the big green triangle (“Start Georeferencing…”). The result map appeared on the map canvas, and it is now in the right position.
In this chapter we will vectorize contour lines which are the basis of creating a surface model. For the first step we create a new shapefile layer.
It’s important to set the shapefile geometry right (in this case we create contour lines, so the geometry will be “LineString”). Create a new column to the describing data table, and name it “z”. Here we are going to write the altitude data of the contour lines.
After creating the table, press “OK”, then the new layer appears. Select this layer by activating “Toggle Editing” and start editing.
Sidenote: If you want your drawing to snap to the other layer’s geometries, activate “Snapping Toolbar” in the menu bar above. Some new icons will appear, from which you choose the small red magnet, called “Enable Snapping” to start the function.
Before we start drawing the contour lines I show a trick to make the map more interpretable. Double click on the new shapefile layer, then choose the “Symbology” menu from the sidebar. Choose “Simple line” option, then increase “Stroke width” to 1.
After that, go to the “Labels” tab and choose the “Single Labels” option. Then select the “z” column beside the “Value” window, then press “OK”.
The point of that is to help you to follow up which of the contour lines have already been vectorized. Also the altitude values of different lines will be visible. Click on the “Add Line Feature” button, and draw the first contour line.
Draw your line with the left mouse button, then close the drawing with a right click. A dialog box will appear, to which you can type in the value of the contour line.
Sidenote: If you are not really into map reading, this will be a useful piece of info. The sole of the contour line always points towards the slope, and it’s also common to mark the direction of the slope with depression.
I hope you can draw better than me… If not, you can modify the vertices by clicking on “Vertex Tool”.
With this tool you can select a section or a vertex, and you can reposition them by clicking. You can add an additional vertex by clicking on the midpoint of the section. If you want to delete the whole geometry, click on the “Select Feature by Area or Single Click” button.
After that, you can select your geometry, then a red trash bin icon will colorize. With that you can delete the selected content.
Once you’re done with drawing, save your results with the floppy disk shaped “Save Layer Edits” button. After that you can close the editor mode. Similar content should appear on you screen (with more elaborate lines):
2.3.3 DATA MERGING
QGIS allows you to use DWG, DXF files from older geodetic surveys along with your own vector data. For this you need to merge two files and save them as one shapefile. The first step is to import a CAD file. If you add a DXF or DWG file to the geometry with the simple drag-and-drop method, the software will ask which geometry you want to use. This is because the topological data model of the QGIS “thinks” in different geometry types, unlike the spaghetti model of CAD (points, lines, surfaces altogether).
In this example I used points for DXF intentionally, because this way we need to merge two different geometry types. In these cases the best way is to create points from lines (in this particular case we used contour lines) or surfaces. You can do that easily by activating “Processing Toolbox Panel” in the upper menu bar with right click. Take the first option and pick the layer that you want to break down into points. Then set the distance between points and decide if you want to work with your result in a temporary layer or want to save it as a separate file.
An important step before merging the two data tables (the contour lines and the DXF file) is to set the coordinate system under the “Source” menu by double clicking on the DXF layer.
Unfortunately, this does not mean that we’re done…because if we mix up the spaghetti model with the topological model, the structure of the data table containing the “z” value will be disrupted. We can open the data table by right clicking to the layer and choosing the “Open Attribute Table” option.
In case of DXF the geometry contains the Z coordinates instead of the attribute. Don’t worry, this article helps you if you feel unsure.
Sidenote: If we would have associated the Z values to the vertices of the lines through the drawing of the contour lines, then the following operations would not be necessary. However in this example I intentionally chose more complex baseline data, because in this industry you often face these challenges.
Type “Extract Z values” into the search field. This function takes the Z coordinates from the geometry (in this case these are DXF points) and writes them into an empty column in the attribute table.
If you open the data table of the created layer you can see that there is a column with Z coordinates. However, its name isn’t “z” column. We need to fix this in order to be able to sum the columns from the two tables. Click on “Open field calculator” inside the attribute table.
Add a new column named “z” which will contain decimal numbers. We don’t have to write anything into the big text box, only look up the “Fields and Values” dropdown list, then double click to the name of the previously generated column. After pressing “OK”, you can see that the new “z” column has been generated.
Save the results of the edit with the floppy disk icon, then close the editor mode.
Now finally it’s time to merge the two data tables. The easiest way is to type “Merge” into the search field. Then pick the “Merge Vector Layers” option. You choose the layers which are to be merged by “…” part of the “Input layers” field.
2.3.4 GENERATING DEM
The hard work of the previous chapters will make sense now: We will create our own elevation model. For making the DEM, we will use interpolation. In QGIS the IDW, TIN, Spline and Kriging geostatistical tools are available (however, the latter two are only as a part of the GRASS addon). Interpolation is a geostatistical calculation, which allows us to create a forecast for the areas with lack of data, based on the known points. This makes us able to create a contiguous surface model. In this article we only present “IDW”, but I encourage you to try out the other methods, because you can get different results. Into the QGIS search field we type “IDW”. Pick the first function. As an input layer, choose your merged layer, then pick the column which contains the Z value. It’s worth it to try different “Distance coefficient P” values and find the best for you. For “Extent” let’s give the extent of the merged layer. Finally, give the resolution of the DEM, based on “Pixel size X and Y”.
Sidenote: If the result file is too large, set a lower resolution for the DEM. This is because the route planner software can barely handle files that are too large and have too high resolution (In case you had forgotten, we are here to create an elevation model for terrain aware flight). 🙂
Once you’re done with parameterization, press the “Run” button. Maybe the calculation will last for a couple of minutes so you have time to drink a delicious coffee. The result will look similar to the following:
3. TAKE CARE OF COORDINATE TRANSFORMATIONS
There are several cases when you have to use a country’s own coordinate system through the vectorizing process. This causes the DEM to be created in the same coordinate system. This is important because the UAS driver uses the WGS84 (EPSG:4326) coordinate system. If you ignore this, your model won’t be in the right place, not along the X, Y and nor along the Z axis.
You can save your DEM as GeoTIFF, while making a coordinate transformation. Unfortunately, my experience is, even though QGIS (and also ArcGIS) can transform X and Y axises quite well, it doesn’t transform the Z axis automatically. This is priority, because if your drone is executing a survey in terrain aware mode, and is flying much lower than intended because of the wrong transformation, it can even crash into something. It can also fly with too high altitude, which may result in worse resolution images. You will have to make the right transformation in order to set the right altitude. Don’t worry, it won’t be that complicated.
I usually start with checking the vertical difference between the base points of the two systems. For example: if I have a Hungarian area, I check the difference of the WGS84 basepoint compared to the basepoint of EOV (the Hungarian national projection system is defined to the Baltic sea level). The difference between the starting point and the basepoint is 44,25 meters, because the basepoint of the WGS84 is that much higher. You can check this difference for any other coordinate systems. So we need to shift our model along the Z axis with that measure. The way to achieve this is to search for “Raster calculator” in QGIS. Open the first function, then give the name of the DEM layer (you can give that from the Layers list, by double clicking on its name) to the “Expression” field. Then give the differences of the base points with positive or negative signs.
Set the original DEM at „Reference layer(s) (used for automated extent, cell size, and CRS) [optional]”. At „Output CRS [optional]” you can set the coordinate system of the output file. Don’t forget that this transformation applies only to horizontal directions. We already made the vertical one, with the previous formula. Press the “Run” button.
Only one tiny thing left: save the terrain model, so the route planner software can easily read it. Right click to the terrain model layer, then choose “Export”, then the “Save As…” option.
At format part, use GeoTIFF and pick the WGS84 coordinate system from the CRS list. There’s one important thing to mention here: most of the software like if there is a “.tfw” worldfile beside DEM file. You can create that by ticking the square before “Create Options” and pressing the green “+” icon. Type “tfw” to the “Name” column of the new row and type “yes” to the “Value” column, then press “OK”.
The digital terrain model with correct X, Y, Z coordinates is now ready. If you managed to get to this point, I congratulate you. 🙂
If you got stuck at some point, you can always contact us, and we will reply in no time.
4. PLAN EVERYTHING
It’s obvious that you need to get the terrain model into the route planner software somehow. We need to plan the flight attitude, how often we want the UAS to change altitude, and also which gimbal position we want the photos to be taken. Let’s discuss these.
A lot of software handles the loading of DEM files in a very user-friendly way. However from my experience I claim that the “Terrain Awareness” function of DJI Pilot can be a bit confusing to users. Even though in the planner everything seems fine, the most common question is: “How can I import the DEM?”. Well you need to create a subfolder called “DSM” in the “DJI” folder on your SD card.. Inside of this, you need to create another folder, and this is the location where you need to copy the GeoTIFF terrain model and the TFW worldfile. If you can’t get it right, watch this video, or read this tutorial.
I don’t have an ultimate number for relative flying height. My method is to examine the distance from the lowest and highest point and I give this value. This is useful because your drone will fly safely even with a quickly elevating surface. Don’t forget that even though it is called terrain awareness, it can be only as accurate as your terrain model is.
Several software has the option that allows you to set how often you want your drone to change altitude. You can find this as “Imitation Fitness” in DJI Pilot and you need to give the value in meters. In fact, this setting determines how often the software requests altitude data and commands the drone to change the altitude. If safety is a priority for you, I recommend setting this value to the minimum. At the beginning of the article – if you remember 🙂 – I’ve been talking about GSD. Well, if it is important to survey with a fixed GSD – and probably it is the goal of it – then I recommend taking photos from nadir, which means the gimbal is tilted in -90° position.
5. FLY ONTO TESTING
Here is some advice at the end, in case you would fly in terrain awareness mode for the first time. Before trying yourself in action I recommend to select a sample area from where you can return your drone (Return To Home – RTH) anytime in safety. Create the terrain model for that area and examine if the drone holds the right altitude and if the DEM is in the correct position etc.
Always take care of the safety of the UAS and your environment. If the elevation and the altitude is changing very quickly I recommend to fly higher.
Did you like what you read? Do you want to read similar ones?
If you really like what you just read, you can share it with your friends via our social media sites. 🙂