Merging Tiles of DTM Data
This guide shows you how to merge multiple tiles of DTM data together in QGIS to create a single DTM file that you can import into UE4 with TerraForm.
If you haven’t got any source data yet, you can download the samples used in this guide to help you follow the steps.
Load the data files into QGIS:
- Select the DTM files in File Explorer and drag them into QGIS:
If not available in the file, QGIS may request you confirm the Coordinate Reference System (“CRS”) of the data you’re importing.
- If you’re using our samples, type ‘British National Grid’ into the search bar and select one of the projection systems listed with the OSGB36 datum.
- Hit ‘OK’.
QGIS will ask you to ‘Select Transformation’ for the DTM files to the default CRS of the Project:
- Click ‘Cancel’ to force QGIS to use the CRS of the DTM files as the CRS for the project.
Finally, select the CRS for the remaining DTM files you’re importing.
Merge the DTM tiles into a single layer:
You will see each of the DTM files is shown with a range of greyscale values from white to black, scaled according to the maximum and minimum elevations in that DTM tile.
While the DTM files are shown as a mosaic in QGIS, they remain individual layers. To export a single file, we need to merge them into the same layer.
- Select ‘Raster’ > ‘Miscellaneous’ > ‘Merge…’
In the ‘Merge’ window that appears:
- In ‘Input Layers’, click the ‘…’ button and check the DTM layers you want to merge. (We selected all 4 layers we loaded.)
- Set the ‘Output data type’ to ‘Float32’.
- Click ‘Run’.
Clip the merged DTM file to the area you want to use to generate your landscape in UE4:
- Select ‘Raster’ > ‘Extraction’ > ‘Clip by Raster Extent…’
In the ‘Clip Raster by Extent’ window:
- The ‘Input layer’ should be set to ‘Merged ’.
- In ‘Clipping Extent’, click the ‘…’ button to the right and choose your clipping method. We used ‘Draw on Canvas’ and drew a box in the main window.
- Hit ‘run’.
Export the clipped DTM as a GeoTIFF:
If you turn off all the layers in the Layers panel other than ‘Clipped (extent)’, you will be able to see that the merged DTM layer has been clipped to the extents you specified.
To export the data:
- Right click on the ‘Clipped (extent)’ layer and select ‘Export > ‘Save As…’.
In the ‘Save Raster Layer as…’ window:
- Make sure the ‘Output mode’ is set to ‘Raw data’.
- Set the ‘Format’ to ‘GeoTIFF’.
- Click the ‘…’ button to the right of ‘File name’, navigate to a location to save the file, and give it a suitable name.
- Set ‘CRS’ to the ‘Project’ CRS.
- Click ‘OK’ to export the data.
Here’s what the data looks like as a landscape in UE4.