Re-Projecting DTM Data
This guide’s all about how to project DTM data in a round-Earth coordinate reference system (“CRS“) to a planar (flat-Earth) CRS. It begins with loading your data into QGIS, so we’re assuming you’ve already got the data you need for your area of interest and have installed QGIS.
If you have other GIS software you prefer (Global Mapper/ArcGIS Pro etc.), you can still follow the same broad steps to prepare your DTM source data for Unreal Engine.
If you haven’t yet got any source data yet, you can download the samples used in this guide.
Load the data into QGIS:
- Select the DTM file in File Explorer and drag it into the project window in QGIS.
A new QGIS project will have a default coordinate reference system already assigned. This is the CRS that the data you load will be displayed in. When you load data that’s stored in a different CRS, QGIS may try to transform it to the project’s CRS.
We don’t want it to do this – instead we want QGIS to display our DTM data in the CRS it’s already stored in:
- In the ‘Select Transformation…’ window that appears, click ‘Cancel’.
It’ll look something like this:
Check the current projection of the DTM data:
UE4 (/TerraForm) needs data in a Cartesian (planar) coordinate reference system, where the pixel units are linear (centimetres/metres/feet/inches etc.). The first thing we need to do is to check the units used by our data, which tell us if it’s in a round-Earth (degrees), or planar coordinate reference system (e.g. metres).
- Double click the DTM file in the ‘Layers’ panel to pull up the ‘Layer Properties’.
- On the ‘Information’ tab, it says the ‘Units’ are ‘degrees’, which means it’s in a round-Earth CRS – we will need to change that.
- It also tells us the data type is ‘Float32’. This is what we want, so we don’t need to change it for this data.
- Click ‘OK’ to close the window.
Set the project’s coordinate reference system:
We want to set our CRS to be a Cartesian planar projection. We’ll use UTM (because it’s accurate and available worldwide) and we’ll set the datum (origin) of the CRS to be WGS84. The UTM coordinate reference system is broken up into zones, so we need to find the correct UTM zone for our data. Our data is in Nevada, US. A quick Google search for ‘UTM Zone Nevada’ gives the result: ‘UTM Zone 11N’.
- The project’s current CRS is shown in the bottom right corner of the screen. In our example it’s EPSG: 4269. Click this to change it.
- Typing ‘WGS 84 / UTM zone 11N’ into the filter gives result we want in the ‘Predefined Coordinate Reference System’ section.
- Select this and click ‘OK’.
In QGIS there are multiple mathematical formulae to transform data from one coordinate reference system to another. We want to select a transformation with a low error value (‘Accuracy (meters)’) and with an appropriate ‘Area of Use’. Given our data’s in Nevada and is north of 38N Latitude, we’ll go for option 3.
- In the ‘Select Transformation…’ window, select option ‘3’.
- Click ‘OK’.
Reproject the DTM data:
Although our DTM’s now displayed in a UTM projection, the source data is still in the original round-Earth coordinate reference system. We need to reproject it.
- Click ‘Raster’ > ‘Projection’ > ‘Warp (Reproject)…’
In the ‘Warp (Reproject)’ window:
- Set ‘Input layer’ to your DTM data.
- Set ‘Target CRS’ to the coordinate reference system for the project (WGS 84 / UTM zone 11N).
- Set ‘Resampling method to use’ to ‘Bilinear’.
- Set ‘Output data type’ to ‘Float32’.
- Click ‘Run’.
Clip the DTM data to the area of interest:
Now the DTM’s in the correct CRS, we need to clip it to the area we want to use to create our landscape in UE4. Even if we wanted to use the whole DTM we would still need to clip it back to a rectangular area, otherwise we would have areas of ‘no-data’ at the edges of our DTM, which UE4 really doesn’t like.
The easiest method for this is to clip it to a box that we can draw:
- Click ‘Raster’ > ‘Extraction’ > ‘Clip Raster by Extent…’
In the ‘Clip Raster by Extent’ window:
- Select the ‘Reprojected’ layer as the ‘Input layer’.
- In ‘Clipping extent’ click the button to the right of the input and select ‘Draw on Canvas’.
- Draw a box to select your area of interest.
- Click ‘Run’ to clip the data.
Export the DTM data:
You can turn off all the layers except the new ‘Clipped (extent)’ layer to check it looks correct – it should be rectangular and the same dimensions as the box you drew in the previous step.
- Right click on it in the ‘Layers’ panel.
- Click ‘Export’ > ‘Save As…’.
In the ‘Save Raster Layer as…’ window:
- Set ‘Output mode’ to ‘Raw data’
- Set the ‘Format’ to GeotTIFF’
- Click on the button to the right of ‘File name’, browse to a location to save your DTM file and give it a name.
- Make sure ‘CRS’ is set to ‘WGS 84 / UTM zone 11N’.
- Click ‘OK’.
You should now be able to import your DTM data into UE4 using TerraForm. Here’s what the data in our example looks like.