Skip to content

Preparing your dataset

DavixDevelop edited this page Aug 17, 2021 · 13 revisions

This guide will teach you, how to prepare your dataset in a suitable raster format. If your dataset is already in the following supported raster formats, you can skip to Part two: Generating/using your dataset

Name Extension
GeoTIFF .tif
Erdas Imagine .img

Before you proceed, check if your country already has a guide here.

Depending on your dataset type, you will be using one of the following three scripts:

Description Software needed
export_dem.py
Dataset format:
LiDAR (.laz or .las)
Suitable, if your LiDAR data contains only ground points or if it contains both ground and off-ground points (Like trees, buildings...). CloudCompare and QGIS
convert_dem.py
Dataset format:
XYZ (.xyz) ASCII Grid (.asc)
Suitable, if your raster data is in any other format than GeoTIFF (.tif) and can be opened using GDAL. The script simply converts the source file to GeoTIFF (.tif) using gdal_translate.

Note, the script also offers an recursive option, to also scan sub-folders. To enable it, simply change the recursive variable to True.
QGIS
export_dem_classification.py
Dataset format:
LiDAR (.laz or .las)
Suitable, if your LiDAR data, contains classified points. Find out more in Preparing your Classified LiDAR dataset CloudCompare and QGIS
convert_TIN_to_raster
Dataset format:
XYZ (.xyz) ASCII Grid (.asc)
Suitable, if your xyz or asc file contain a TIN surface. This also assumes that the columns are order in the order: x y z, with a delimiter like space or semicolon in between. To change the delimiter being used (space by default), change the source_delimiter variable. Make sure to set the source epsg, by changing the source_epsg variable to 'EPSG:<YOUR EPSG CODE>'.

Note, the script also offers an recursive option, to also scan sub-folders. To enable it, simply change the recursive variable to True.
QGIS

Regardless, of which script you choose, all follow the same general procedure. Each script also contains comments if you want to change something, like for which formats should the script scan for For example, in the convert_dem.py script, you would change the line:56, to the format your dataset uses, that GDAL can open.

Again, It's very important that you read the comments before you try to reach out for help.

Part one: Preparing your dataset

A. Software preparation

  • CloudCompare : Download and install the latest stable release of CloudComapre (2.11.3) from here
  • QGIS : Download and install the latest version of QGIS (3.16) in OSGeo4W
  • Download QCSF_PLUGIN.dll and put it in the plugins folder of CloudCompare. Ex. C:\Program Files\CloudCompare\plugins

B. Generating dem files

  • Download and place your lidar/source files into a folder (ex. Documents\Minecraft\Source)
  • Open QGIS and navigate to Plugins/Python Console in the toolbar
  • In the opened bottom panel click on the Show Editor button (Script icon)
  • Open the script you choose using the Open Script... button (Folder icon)
  • Once open navigate to the source_directory line (line: 14)
  • Here replace the path with your path to the folder where you lidar/source data is saved and make sure to use double backslash
  • Then navigate to the dem_directory line (line: 15) and replace the path where you wish to save the converted/transformed dataset, making sure to use double backslash
  • Save the changes using the Save button (Floppy disk icon)
  • Navigate to View/Panels/Log Messages in the toolbar
  • Now, depending on how many lidar/source files you have this can take quite a while, up to multiple hours if you use the export_dem script. Click on the Run Script button (green play button)
  • After the script is finished you will get a notification from QGIS

Now that your dataset is in the suitable GeoTIFF (.tif) format, you can follow the Part two: Generating/using your dataset, using dataset in the folder that you defined in the dem_directory variable.

Need help or have a question?

You can contact me on Discord, under davixdevelop#3914, or you can join us on our BTE Development Hub on Discord, and ask away under the #terraplusplus-support channel.