Skip to content

Custom terrain dataset guide

DavixDevelop edited this page Feb 24, 2021 · 32 revisions

Custom Terrain from Lidar data/Raster data

This guide is intended for those who wish to use the custom terrain feature for Terra++ and wish to use lidar/raster data as the data source. Before you continue, check if your country already has a guide here.

This guide is split into two parts.

Preparing your dataset Generating/using your dataset
This guide teaches you how to prepare your dataset, if your dataset is in any other format then GeoTIFF (.tif), for example, if you wish to use LiDAR data. The second part teaches you, how to generate/use the optimized dataset
Link to Part one Read bellow

Part two: Generating/using your dataset

A. QGIS preparation & QMetaTiles plugin

  • First, download and install the latest version of QGIS in OSGeo4W
  • After installing, open it
  • Navigate to Plugins/Manage And Install Plugins... in the toolbar
  • In the opened window click on All and search for QMetaTiles
  • Click on the result and install it
  • Close the window

B. Importing your dataset

Note: This assumes, your dataset is already in the GeoTIFF (.tif) format. If not, go here. You can also find a version of the import script that imports all files in a folder, including subfolders here.

  • Next, navigate to Plugins/Python Console in the toolbar
  • In the opened bottom panel click on the Show Editor button (Script icon)
  • Using the Open Script... button open the loadraster_folder.py file (or loadraster_folder_recursive.py if you want to also import files from subdirectories) in QGIS Python Console
  • Double click on OpenStreetMap in the left panel (Under 'XYZ Tiles' in the Browser panel [View/Panels/Browser])
  • Navigate to the file_directory line (line: 65)
  • Here replace the path with your path to the folder where your .tif files are located
  • Save the changes using the Save button (Floppy disk icon)
  • Navigate to View/Panels/Log Messages in the toolbar
  • Now, run the script by clicking on the Run Script button (green play button)
  • It may lag a bit at the start and the end but let it run. Again, this can take a while
  • The script outputs the progress into the Log Messages panel
  • Once It's done QGIS will send you a notification

C. Setting up the project

  • Select all your imported layers in the left and right-click on them
  • Navigate to Set CRS/Set Layer CRS...
  • In the opened window choose the same coordinate reference system your lidar/source dataset uses (ex. Slovenia 1996 / Slovene National Grid). If you have problems with this step, select the layer, go to Layers/Save as, set the CRS, save the file/files and repeat the C section.
  • Click OK
  • In the bottom right corner click the current project coordinate reference system (ex EPSG...)
  • In the opened windows search for EPSG:4326 (WGS 84)
  • Click on WGS 84 and click OK
  • Make sure the layers are in the right location over the map

D. Generating tiles

  • Delete the OpenStreetMap layer
  • Navigate to Plugins/QMetaTiles/QMetaTiles
  • Set the Tileset name and choose the Output Directory (ex. Documents\Minecraft\CustomTerrain)
  • Select Full extent (Make sure the OpenStreetMap layer is deleted)
  • Set the Minimum and Maximum zoom to 17, or lower depending on the resolution of your data, or if you want the dataset to use less space
  • Disable Metatiling
  • Set the Quality under Parameters to 100
  • Select Make lines appear less jagged at the expense of some drawing performance
  • Make sure that the format is set to PNG
  • Click OK
  • This will take quite a while depending on how large an area you have
  • Once It's finished you can close QGIS

E. Dataset bounds

If you already know your bounding box coordinates, and they are in the WGS 84 (EPSG:4326) coordinate system, you can skip this step. If they are not in the WGS 84 (EPSG:4326) coordinate system, skip to Converting the bounds to WGS 84 (EPSG:4326). Else continue with the guide.

Finding your dataset bounds

  • Note: If you only imported one file, you can simply right click on the layer, click on Properties... and take note of the Extent under Information as seen on the image above. Then you can continue to the step bellow, if the layer CRS isn't WGS 84 (EPSG:4326). If it is, you can continue to step F. There are two ways you can find the bounding box corindates. You can either find the bottom left and top right layer, or you can create a virtual raster.

First method Second method
First find the leftmost layer. Right click on the layer, and go to Propreties.... Take note of minX on Extent under Inforamtion (as seen on the image above). Next find the rightmost layer, and take note of maxX via Propreties... again. Now find topmost layer and take note of maxZ. Lastly, find the bottommost layer and take note of minZ. Then you can continue to the step bellow, if the layers CRS isn't WGS 84 (EPSG:4326). If it is, you can continue to step F. First go to Raster/Miscellaneous/Build Virtual Raster.... Once the dialog opens, under Input layer, select all layers (as shown on the image image). Once you've selected all layers, click on the back arrow. Next under Resolution select Highest and click on the Run button bellow. Once the process finishes, close the dialog by clicking on the Close button. Lastly right click on the newly created layer (Virtual) and click on Properties.... Next take note of minX, maxX, minZ and maxZ on Extent under Inforamtion. Now you can continue to the step bellow, if the Virtual layer CRS isn't WGS 84 (EPSG:4326). If it is, you can continue to step F.

Converting the bounds to WGS 84 (EPSG:4326)

  • First navigate to the epsg.io page
  • Now search for your coordinate system (ex. Slovenia 1996 / Slovene National Grid)
  • Once you've opened the coordinate system page, click on Transform
  • First under Input coordinates, input minX on the X textbox and minZ on the Z textbox, as shown on the image above
  • Make sure that under Output coordinates, Format is set to dec
  • Then click on Transform and under Output coordinates take note of Longitude and Latitude. The Longitude becomes minX and Latitude becomes minZ.
  • Lastly, repeat the process for maxX and maxZ

F. Using your generated dataset

  • Download and install Terra++ from here or build it yourself from here

Note: Recently the mod went through a large improvement, so if you have problems with loading previous saves, contact me on Discord (Scroll down for contact).

Note: As the new heights config is different from the old one, it is very important that you recreate your heights config, using the provided heights.json file

It is also very essential that your heights folder doesn't contain the old default.json5 or any file with the json5 extension. If it does, you must also delete the .json file and set it up again, by following the steps below

Note: If your .minecraft folder doesn't contain the terraplusplus folder, you must first create the world using the World Type: Build The Earth

  • Download heights.json, and move it to .minecraft\terraplusplus\config\heights (ex. C:\Users\david\AppData\Roaming.minecraft\terraplusplus\config\heights)
  • Open heights.json in a text editor
  • As shown in the picture, in step 1, replace (path to dataset) with your path to your dataset, for example, C:/Users/david/Documents/Minecraft/CustomTerrain/Flats
  • Next to it, as shown in step 2, replace (zoom level) with the level of zoom, you rendered your dataset under
  • Then, as shown in step 3, also replace (zoom level) with the level of zoom, you rendered your dataset under
  • Finally, paste in the noted minX, minZ, maxX and maxZ (from step E) under bounds as shown in step 4. The cooridantes must be in WGS 84 (EPSG:4326)
  • Save the file, open Minecraft, and load the save you've created or create a new world using the World Type: Build The Earth
  • Once your world loads, navigate to your desired location using the /tpll command and it should load your custom terrain

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.

Clone this wiki locally