<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=IskenderWang</id>
	<title>FlightGear wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=IskenderWang"/>
	<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/Special:Contributions/IskenderWang"/>
	<updated>2026-04-15T17:19:24Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Using_TerraGear&amp;diff=133515</id>
		<title>Using TerraGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Using_TerraGear&amp;diff=133515"/>
		<updated>2021-10-14T18:23:43Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: /* Related content */ add new guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Out of date}}&lt;br /&gt;
&lt;br /&gt;
[[File:Terragearprocesschart.png|thumb|TerraGear Process Flow Chart]]&lt;br /&gt;
The [[TerraGear]] software project supports [[FlightGear]] by creating the files used by FlightGear to represent the elevation and texture of the earth, including airports, cities, fields, forests, rivers, roads and so on. The TerraGear software reads data files containing ground elevation, airport locations and layouts, geographical land-cover data, and more, and produces the scenery files used by FlightGear to represent the terrain of the world.&lt;br /&gt;
&lt;br /&gt;
For simplicity and convenience, most FlightGear users simply download the plug-and-play scenery files from the FlightGear scenery server, or use [[TerraSync]] to automatically download scenery as needed. But there is a variety of reasons you might want to use TerraGear to produce your own terrain files, rather than downloading the standard FlightGear scenery. &lt;br /&gt;
&lt;br /&gt;
For instance, if you use [[WorldEditor]] to modify/improve information about an [[:Category:Airports|airport]]'s taxiway/apron layout, you might wish to see how that modified airport would look in the scenery before deciding you're happy with the results. Maybe the official scenery is too detailed for your slow machine, and you'd like to build terrain using a digital elevation model (DEM) with poorer resolution, to decrease the number of polygons and thus improve your framerates. Or maybe you've got a fantastically fast machine, and you want to build your own terrain using higher-resolution vector data (vmap1, Tiger, osm) to get better roads/streams. For all these reasons, learning how to use TerraGear is a good idea.&lt;br /&gt;
&lt;br /&gt;
== Obtaining TerraGear ==&lt;br /&gt;
You can either build TerraGear yourself, or download a pre-compiled binary. The latter is the easiest and advised for starters.&lt;br /&gt;
&lt;br /&gt;
* '''Option 1a - Download TerraGear pre-compiled (recommended for beginners) on Windows'''&lt;br /&gt;
*# Download the latest TerraGear (TerraGearGUI included) build from: http://www.mediafire.com/file/ul2xy2ykgig2mct/160605_Sucessfull_Terragear_Win_Built.7z. This is by BecOzlacan, it's very stable and works well.&lt;br /&gt;
*# Create or choose a directory to hold the TerraGear tools. &lt;br /&gt;
*# Unzip the package.&lt;br /&gt;
&lt;br /&gt;
* '''Option 1b - Download ppa packages for Ubuntu Linux'''&lt;br /&gt;
&lt;br /&gt;
https://launchpad.net/~saiarcot895/+archive/ubuntu/flightgear-edge/+index?batch=75&amp;amp;memo=75&amp;amp;start=75&lt;br /&gt;
&lt;br /&gt;
* '''Option 1c - Use the TerraGear Docker instance'''&lt;br /&gt;
&lt;br /&gt;
[[Howto:Docker_scenery_toolchain]]&lt;br /&gt;
&lt;br /&gt;
* '''Option 2 - Compile TerraGear from source code''' as explained in [[Building TerraGear|this article]].&lt;br /&gt;
&lt;br /&gt;
{{note|1=You might need &amp;lt;code&amp;gt;default_priorities.txt&amp;lt;/code&amp;gt; from the {{terragear source|path=src/BuildTiles/Main/default_priorities.txt|text=git repository}} or from the archive downloaded from the build server (in the &amp;lt;code&amp;gt;archive/install/msvc100/TerraGear/share&amp;lt;/code&amp;gt; subdirectory). See [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;p=77950 this forum thread] for details.}}&lt;br /&gt;
&lt;br /&gt;
=== GUI tool ===&lt;br /&gt;
A [[TerraGear GUI]] is available for those that would like to use TerraGear without knowing/using the command line options.&lt;br /&gt;
&lt;br /&gt;
== Using TerraGear ==&lt;br /&gt;
First, choose the boundaries for the area of scenery you want to build, in terms of latitude and longitude. The smaller the area of scenery you generate, the smaller the amount of data you will need, and the less CPU time it will take. For example, if you are just interested in generating a new airport layout at 12.3W 34.4N, then simply generating the scenery between 12W 34N and 13W 35N would be sufficient. &lt;br /&gt;
&lt;br /&gt;
Write down the bounding box (minimum and maximum longitude and latitude) for the scenery you want to generate. Remember that West and South are negative - in essence 4W 10S would be -4, -10. Try not to get mixed up, otherwise you'll end up generating scenery or airports on the other side of the planet! &lt;br /&gt;
&lt;br /&gt;
You'll be dealing with multiple different types of data in various formats. Create a new directory for your scenery work. Within that directory, create the following sub-directories: &lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;data/&amp;lt;/code&amp;gt;:    For raw and pre-processed data (eg elevation files) &lt;br /&gt;
; &amp;lt;code&amp;gt;output/&amp;lt;/code&amp;gt;:  For the scenery files you will create &lt;br /&gt;
; &amp;lt;code&amp;gt;work/&amp;lt;/code&amp;gt;:    For data that has been processed (eg by shape-decode) and is ready to be munged into scenery &lt;br /&gt;
&lt;br /&gt;
=== Obtaining and processing data ===&lt;br /&gt;
TerraGear uses three different kinds of information to generate scenery:&lt;br /&gt;
&lt;br /&gt;
# The elevation of the land (provided by SRTM) &lt;br /&gt;
# The location and layout of airports (provided by apt.dat or a custom .dat) &lt;br /&gt;
# Whether a given lat/lon is sea, land, city, forest, town, road, railway (provided by VMAP0, [[CORINE]] etc. or custom shapefiles) &lt;br /&gt;
&lt;br /&gt;
This article describes how obtain and process each of these types of data in order, and bring it together for use by FlightGear. The order of these steps is important. For example, the airport data step needs the elevation data to determine the elevation of the airports and thus you should start with preparing elevation data.&lt;br /&gt;
&lt;br /&gt;
{{caution|For inclusion in the official FlightGear scenery, all data '''must''' come from [[GNU GPL]] compatible sources!}}&lt;br /&gt;
&lt;br /&gt;
==== Elevation data ====&lt;br /&gt;
The best worldwide elevation data currently available is from the Shuttle Radar Topography Mission (SRTM). There are two types of SRTM data: &lt;br /&gt;
* Highly accurate 1-arcsecond resolution data, known as SRTM-1, for the USA &lt;br /&gt;
* Less accurate 3-arcsecond resolution data, known as SRTM-3, for the rest of the world. &lt;br /&gt;
From now on, we'll assume you are using SRTM-3 data. Unless otherwise noted, the process for SRTM-1 is identical.&lt;br /&gt;
&lt;br /&gt;
You can download the appropriate data from http://viewfinderpanoramas.org/Coverage%20map%20viewfinderpanoramas_org3.htm. You want all .hgt.zip files covering your region of interest. Depending on the size of your scenery, there may be quite a few. Download them to &amp;lt;code&amp;gt;data/SRTM-3/&amp;lt;/code&amp;gt; (or SRTM-1/SRTM-30 depending on the type you downloaded) in your base directory. (Genapts looks for a few known, hardcoded elevation data directories in its working directory. SRTM-30 is one of them and this is the least confusing in that list. Note: W.E.F. 31st July 2010, the genapts tool now also looks for SRTM-1/SRTM-3 directories. If you are using an older version, please supply the directories using --dem-path).&lt;br /&gt;
&lt;br /&gt;
Now we've got the data, we need to convert it into something of use to TerraGear. First, you need to unzip each of the .hgt files. After that, open the commandline (Windows: Start &amp;gt; Run &amp;gt; &amp;lt;code&amp;gt;cmd.exe&amp;lt;/code&amp;gt;) and change into the base directory (&amp;lt;code&amp;gt;cd .../.../TerraGear&amp;lt;/code&amp;gt;).&lt;br /&gt;
&lt;br /&gt;
{{note|According to [[TerraGear_Documentation]], hgtchop is superseded by gdalchop.}}&lt;br /&gt;
{{note|For SRTM-1 data, replace the &amp;lt;code&amp;gt;3&amp;lt;/code&amp;gt; by a &amp;lt;code&amp;gt;1&amp;lt;/code&amp;gt; in the first argument to hgtchop}}&lt;br /&gt;
{{tip|If you want to create a batch-file, replace &amp;lt;code&amp;gt;%f&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;%%f&amp;lt;/code&amp;gt;, see [http://technet.microsoft.com/en-us/library/bb490909.aspx]}}&lt;br /&gt;
&lt;br /&gt;
For Windows:&lt;br /&gt;
 for %f in (.\data\SRTM-3\*.hgt) do .\Terragear\hgtchop.exe 3 %f .\work\SRTM-3&lt;br /&gt;
or&lt;br /&gt;
 for %f in (.\data\SRTM-3\*.hgt) do .\Terragear\hgtchop.exe 3 .\data\SRTM-3\%f .\work\SRTM-3&lt;br /&gt;
&lt;br /&gt;
For Linux:&lt;br /&gt;
 for f in ${PWD}/data/SRTM-3/*.hgt; do ./Terragear/hgtchop 3 &amp;quot;${f}&amp;quot; &amp;quot;${PWD}/work/SRTM-3&amp;quot;; done&lt;br /&gt;
&lt;br /&gt;
Now you will get a lot of .arr.gz files in your work/SRTM-3/ directory. We need to convert these to the .fit.gz format. Run the commandline again with&lt;br /&gt;
&lt;br /&gt;
{{note|The space and dot at the and are important!}}&lt;br /&gt;
&lt;br /&gt;
For Windows:&lt;br /&gt;
 .\Terragear\terrafit.exe work\SRTM-3&lt;br /&gt;
&lt;br /&gt;
For Linux:&lt;br /&gt;
 ./Terragear/terrafit work/SRTM-3&lt;br /&gt;
&lt;br /&gt;
==== Airport data ====&lt;br /&gt;
Now we've got elevation data, we can generate our airports. First, create a &amp;lt;code&amp;gt;data/airports/&amp;lt;/code&amp;gt; directory and copy in your apt.dat file. This may be direct from your FlightGear data package (though you'll need to unzip it), or it may be one that you've modified with [[WorldEditor]]. &lt;br /&gt;
&lt;br /&gt;
The command to create airports is &amp;quot;genapts850&amp;quot;. Run it without any arguments to see the various command-line options. &lt;br /&gt;
&lt;br /&gt;
If it is simply run with a specified apt.dat and work directory, it will generate airport layouts for every airport in the file, which can take a long time. Make sure the input is not the apt.dat.gz, but an uncompressed file. Otherwise genapts850 will block and not produce any output.&lt;br /&gt;
&lt;br /&gt;
If you are just creating a single airport and you know the ICAO ID (for example [[San Francisco International Airport|KSFO]], EGPH or EG32), use it as follows from your root scenery directory (in essence the directory above your data, work and output directories). If you use an apt.dat file with one single airport in it you should omit the &amp;lt;code&amp;gt;--airport&amp;lt;/code&amp;gt; parameter. &lt;br /&gt;
&lt;br /&gt;
 genapts850 --input=data/airports/apt.dat --work=./work --airport=&amp;lt;AIRPORT_ID&amp;gt;&lt;br /&gt;
&lt;br /&gt;
or, if you have elevation data available:&lt;br /&gt;
&lt;br /&gt;
 genapts850 --input=data/airports/apt.dat --work=./work --dem-path=SRTM-3&lt;br /&gt;
&lt;br /&gt;
If you are generating a larger set of scenery, then you can specify the minimum and maximum longitude and latitude. &lt;br /&gt;
&lt;br /&gt;
Genapts will create two sub-directories in your work directory:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;AirportArea/&amp;lt;/code&amp;gt;&lt;br /&gt;
* &amp;lt;code&amp;gt;AirportObj/&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These contain the definitions of the airport layout and any objects present (e.g. windsocks and beacons).&lt;br /&gt;
&lt;br /&gt;
==== Landuse data ====&lt;br /&gt;
&lt;br /&gt;
{{note|The text in this section refers to using data from the MapServer, which has been discontinued. Land use data (shapefiles) should be acquired from another source for now.}}&lt;br /&gt;
&lt;br /&gt;
The final piece of data we need to generate is the landuse data. In general, this is taken from the VMAP0 dataset as shapefiles from the scenery database mapserver, but other sources can also be used.&lt;br /&gt;
&lt;br /&gt;
The landuse data can be split into a number of different types:&lt;br /&gt;
&lt;br /&gt;
; Landmass:  Separates the land from the sea. It can be used as a mask for all other data. The most commonly used is the VMAP0 Landmass, but GSHHS can also be used. When running tg-construct with &amp;lt;code&amp;gt;--ignore-landmass&amp;lt;/code&amp;gt;, all input shapefiles will be taken into consideration, so no landmass mask is required then.&lt;br /&gt;
; Land use data:  Defines whether a piece of land is forest, urban, sand, lava, glacier etc. These are usually VMAP0 data, defined as polygons.&lt;br /&gt;
; Line data:  Includes railroads, streams, roads. Typically VMAP0, but also OpenStreetMap for roads.&lt;br /&gt;
; Point data:  Is currently only used for defining towns.&lt;br /&gt;
 &lt;br /&gt;
By far the easiest way to get this data is to download shapefiles from the wonderful [http://mapserver.flightgear.org MapServer]. The MapServer lets you download the shapefiles for any selected scenery area. Click on the &amp;quot;Download Shapefiles&amp;quot; link (or go direct: http://mapserver.flightgear.org/download.psp). Enter in the bounding box of the scenery you want to generate, select the type of shapefile data you want, and click download.&lt;br /&gt;
&lt;br /&gt;
==== Layers ====&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;v0&amp;lt;/code&amp;gt;:  Global coverage, low detail. This is &amp;quot;the last resort&amp;quot;, but unfortunately it is the only layer that covers the entire world.&lt;br /&gt;
; &amp;lt;code&amp;gt;cs&amp;lt;/code&amp;gt;:  It is v0 with some contributions someone did in the past. Get this instead of v0.&lt;br /&gt;
; &amp;lt;code&amp;gt;v1&amp;lt;/code&amp;gt;:  Only parts of some countries available, higher detail than v0.&lt;br /&gt;
; &amp;lt;code&amp;gt;clc06&amp;lt;/code&amp;gt;:  European '''only'''. Very high detail, this is the preferred choice for an European country.&lt;br /&gt;
; &amp;lt;code&amp;gt;osm&amp;lt;/code&amp;gt;:  Global coverage, high resolution but very low detail.&lt;br /&gt;
: This means: if you are interested in an area out of Europe and forests are defined in OpenStreetMaps for your area, this is going to be the best data source. If forests are not defined, you will get a dull, neverending DEFAULT landclass. OSM provides the best coastline and I encourage you to use this coastline even in Europe. [http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=25549&amp;amp;sid=d501cb651ef9e34ca9dc8fae429d51ab&amp;amp;p=234002#p234002]&lt;br /&gt;
&lt;br /&gt;
{{caution|Make sure each shape file is in its own directory whether you download shape files or create your own otherwise the ogrDecode step will fail.}}&lt;br /&gt;
Download each shapefile into a seperate (!) &amp;lt;code&amp;gt;data/shapefiles/...&amp;lt;/code&amp;gt; directory. So, for v0_landmass, you would end up with &amp;lt;code&amp;gt;data/shapefiles/v0_landmass/v0_landmass.shp&amp;lt;/code&amp;gt; etc.&lt;br /&gt;
&lt;br /&gt;
You can load these shapefiles into a GIS editor such as [[QGIS]] or GRASS to view and edit. This is a good idea to verify you have the correct files! Later on, you can experiment with replacing various shapefiles with other versions (GSHHS for coastline, OSM for roads etc.).&lt;br /&gt;
&lt;br /&gt;
The next step is to decode the shape-files into TerraGear format using the '''ogr-decode''' command (renamed to '''poly-decode''' in recent versions of TerraGear). &lt;br /&gt;
&lt;br /&gt;
There are three important command-line arguments for ogr-decode:&lt;br /&gt;
* the destination directory for the decoded data&lt;br /&gt;
* the location of the shapefile's directory&lt;br /&gt;
* the material type&lt;br /&gt;
&lt;br /&gt;
Each shape-file corresponds with one of the material types defined in the materials.xml files. The mapping is pretty obvious. For example, &amp;lt;code&amp;gt;v0_mixedcroppasturecover&amp;lt;/code&amp;gt; maps to &amp;lt;code&amp;gt;MixedCropPastureCover&amp;lt;/code&amp;gt;. Note that the material types are case-sensitive, so it is a good idea to refer to the &amp;lt;code&amp;gt;[[$FG_ROOT]]/Materials/default/materials.xml&amp;lt;/code&amp;gt; file (&amp;lt;code&amp;gt;[[$FG ROOT]]/materials.xml&amp;lt;/code&amp;gt; in FlightGear 2.6.0 and older) to hand so you can check. The exception is landmass, which - when used - MUST be mapped onto the type Default.&lt;br /&gt;
&lt;br /&gt;
Additionally, there are a number of optional arguments, to indicate the width of line data (for roads, streams, railways), how large to make point data (for towns) and how long the longest straight line is allowed to be.&lt;br /&gt;
&lt;br /&gt;
For example, to decode the &amp;lt;code&amp;gt;v0_landmass&amp;lt;/code&amp;gt; shapefile, you use the following command:&lt;br /&gt;
&lt;br /&gt;
 ogr-decode --max-segment 500 --area-type Default work/Default data/shapefiles/v0_landmass&lt;br /&gt;
&lt;br /&gt;
To create streams of width 10 metres&lt;br /&gt;
&lt;br /&gt;
 ogr-decode --max-segment 500 --line-width 10 --area-type Stream work/Stream data/shapefiles/v0_stream&lt;br /&gt;
&lt;br /&gt;
To generate some towns about 1km across&lt;br /&gt;
&lt;br /&gt;
 ogr-decode --point-width 500 --area-type Town work/Town data/shapefiles/v0_town&lt;br /&gt;
&lt;br /&gt;
Run this command for each shapefile in the set.&lt;br /&gt;
&lt;br /&gt;
== Generating scenery ==&lt;br /&gt;
You will now have a work directory, with subdirectories like:&lt;br /&gt;
{|&lt;br /&gt;
|&lt;br /&gt;
: AirportArea&lt;br /&gt;
: AirportObj&lt;br /&gt;
: Bog&lt;br /&gt;
: Default&lt;br /&gt;
: DryCropPastureCover&lt;br /&gt;
: EvergreenBroadCover&lt;br /&gt;
: GrassCover&lt;br /&gt;
: IrrCropPastureCover&lt;br /&gt;
: Lake&lt;br /&gt;
: Marsh&lt;br /&gt;
: MixedCropPastureCover&lt;br /&gt;
| valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
: MixedForestCover&lt;br /&gt;
: Railroad&lt;br /&gt;
: Road&lt;br /&gt;
: Sand&lt;br /&gt;
: ScrubCover&lt;br /&gt;
: Shared&lt;br /&gt;
: SRTM-3&lt;br /&gt;
: Stream&lt;br /&gt;
: Town&lt;br /&gt;
: Urban&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Now we can actually generate the scenery. This is done by the tg-construct command. Run the command with &amp;lt;code&amp;gt;--help&amp;lt;/code&amp;gt; to get usage information. &lt;br /&gt;
&lt;br /&gt;
We need to define:&lt;br /&gt;
* The work (&amp;lt;code&amp;gt;--work-dir&amp;lt;/code&amp;gt;) and output (&amp;lt;code&amp;gt;--output-dir&amp;lt;/code&amp;gt;) directories.&lt;br /&gt;
* The center of the scenery we want to generate (&amp;lt;code&amp;gt;--lat&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--lon&amp;lt;/code&amp;gt;).&lt;br /&gt;
* The radius (&amp;lt;code&amp;gt;--xdist&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;--ydist&amp;lt;/code&amp;gt;) from which to generate.&lt;br /&gt;
* All the work directories to include in the scenery.&lt;br /&gt;
&lt;br /&gt;
{{note|The output directory must point to a &amp;lt;code&amp;gt;Terrain/&amp;lt;/code&amp;gt; directory, else recent FlightGear versions will be unable to load the terrain.}}&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
{{Pre2|&amp;lt;nowiki&amp;gt;tg-construct --work-dir=./work --output-dir=./output/Terrain --min-lon=55 --max-lon=57 --min-lat=60 --max-lat=62 AirportArea SRTM-3 AirportObj Default Stream Bog IrrCropPastureCover Town Lake Urban Railroad DryCropPastureCover Road EvergreenBroadCover Marsh Sand MixedCropPastureCover ScrubCover GrassCover MixedForestCover&amp;lt;/nowiki&amp;gt; }}&lt;br /&gt;
&lt;br /&gt;
When this finishes, the output directory will contain a scenery sub-tree. Point to it by setting either [[$FG_SCENERY]] or by using the &amp;lt;code&amp;gt;--fg-scenery&amp;lt;/code&amp;gt; command-line option to fgfs, and give your new scenery a try!&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
Below is a list of common problems and solutions. If in doubt - Google it. Many problems (particularly when compiling TerraGear) have been hit before: &lt;br /&gt;
&lt;br /&gt;
* Crashes in genapts. Sometimes genapts will crash when dealing with a particular airport. In that case, try running it again with the &amp;lt;code&amp;gt;--start-id&amp;lt;/code&amp;gt; argument to start at the airport it failed on, and the &amp;lt;code&amp;gt;--nudge&amp;lt;/code&amp;gt; argument which tries to nudge the calculations in the right direction. &lt;br /&gt;
* tg-construct killed. The tg-construct process may kill itself if it is using too many system resources. Increasing the values for &amp;lt;code&amp;gt;setrlimit&amp;lt;/code&amp;gt; in &amp;lt;code&amp;gt;src/BuildTiles/Main/main.cxx&amp;lt;/code&amp;gt; is the best solution. &lt;br /&gt;
* tg-construct silently stops immediately without an error and nothing goes to the &amp;quot;output&amp;quot; directory: make sure that lon/lat values correspond to tiles boundaries. See [[Tile Index Scheme]]&lt;br /&gt;
* tg-construct says it is building the tiles requested, but at the end, nothing has been built: even if the requested tiles are covered by the elevation file (.hgt), tg-construct needs at least a default shapefile covering any terrain, or else it skips the tile with no output.&lt;br /&gt;
* Airports appear in the bottom of holes, or there are spaces between the airports and the scenery. This typically happens when genapts is unable to find the correct elevation data, or the elevation data changed between running genapts and shape-decode. Try generating a single airport in your scenery area using genapts, and look at the output. In particular, make sure there is a work/SRTM-3 directory. &lt;br /&gt;
* Only the airports appear in the scenery. There are three typical causes for this: &lt;br /&gt;
** You didn't download the correct shapefiles for the area. &lt;br /&gt;
** You haven't run shape-decode on the &amp;lt;code&amp;gt;v0_landmass&amp;lt;/code&amp;gt; shapefile as Default &lt;br /&gt;
** You didn't include the correct directories in tg-construct. &lt;br /&gt;
* Generate scenery includes data removed from the shapefiles. If you are editing shapefiles, you need to delete the appropriate work subdirectory before running shape-decode. Otherwise your changes will be in addition to those already present. &lt;br /&gt;
* All the scenery is flat and at sea-level. Typically this is because you didn't include any elevation data in your tg-construct command. Make sure there's a STRM-3 directory included in the command-line. &lt;br /&gt;
* All terrain copies the material of a certain shapefile. You have probably forgotten to put each of the downloaded shapefiles in a seperate directory inside the Data/shapefiles directory.&lt;br /&gt;
* genapts850 never passes the stage &amp;quot;Adding airport &amp;lt;ICAO&amp;gt; to parse list&amp;quot;: did you unzip &amp;lt;code&amp;gt;apt.dat.gz&amp;lt;/code&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
== General comments from forum discussion ==&lt;br /&gt;
{{cquote|f-ojac, you are right, the parameters used in scenery 2.0 were &amp;quot;-e 5 -x 20000&amp;quot; according to the wiki. I don't know why I had the impression these parameters were not public. In any case, it does not matter because using the same parameters will create closer results, but they are not guaranteed to be the same.&lt;br /&gt;
&lt;br /&gt;
The parameters used to create scenery 2,0 seem to be:&lt;br /&gt;
&lt;br /&gt;
-m ??: the minimum number of vertices in a tile. In FG, any number bellow 100 (and probably, any number below 1000) will do. I don't think there is any surface on the world perfectly flat for several kilometers. The default value is 50 and I'm sure is ok for any normal use.&lt;br /&gt;
-e 5: the max allowed error for elevation, in meters. That is: if terrafit calculates a simplification of the terrain where all points are at most this distance from the real elevation, no more vertices are created. The default value is 40 meters: a point may have an elevation error up to 40m (~100ft) High values for this parameter create less detailed mountains and smaller (in disk size) and more efficient (in FPS) terrain.&lt;br /&gt;
-x 20000: the max number of vertices in a tile. If this number of vertices is reached, terrafit stop regardless the max error of the vertices. The default value is 1000&lt;br /&gt;
&lt;br /&gt;
Keep in mind you can set values that do not make sense:&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;-e 1 -x 100&amp;quot; does not make sense because it is going to be impossible to calculate errors less than 1 meters using only 100 vertices. The max number of vertices will be reached always and the max error will be probably ignored.&lt;br /&gt;
* &amp;quot;-e 300 -x 20000&amp;quot; does not make sense, tiles are going to use for sure much less vertices than 20,000 because you are allowing huge elevation errors.&lt;br /&gt;
&lt;br /&gt;
If you want an efficient scenery (less vertices), use the default values &amp;quot;-e 40 -x 1000&amp;quot;. If you want more accurate elevation at the cost of disk space and FPS, use values similar to scenery 2.0 (&amp;quot;-e 5 -x 20000&amp;quot;) Anything in the middle will produce performance and disk use in the middle.&amp;lt;ref&amp;gt;{{cite web |url=http://forum.flightgear.org/viewtopic.php?f=5&amp;amp;t=24681#p225363 &lt;br /&gt;
|title=Re: Terrasync Help (surprinsingly!) :)&lt;br /&gt;
|author=ludomotico |date= Mon Nov 24, 2014 4:28 am}}&amp;lt;/ref&amp;gt;|ludomotico}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Related content ==&lt;br /&gt;
* [[Howto:Use TerraGear without wanting to kill yourself]], self-explanatory, contains the most recent info.&lt;br /&gt;
* [[Howto:Create custom terrain]], editing/making terrain data.&lt;br /&gt;
* [[TerraGear CORINE]], building terrain from CORINE data.&lt;br /&gt;
* [[TerraGear Documentation]], using TerraGear details.&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enhancement|TerraGear, Using]]&lt;br /&gt;
&lt;br /&gt;
[[fr:Utiliser TerraGear]]&lt;br /&gt;
[[zh:Using TerraGear]]&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear_Documentation&amp;diff=133514</id>
		<title>TerraGear Documentation</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear_Documentation&amp;diff=133514"/>
		<updated>2021-10-14T18:20:28Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: /* Related content */ Add new guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There has been a lot of questions relating to scenery generation tools. This page is an attempt to document each of the tools I use. I will also document the design, and what each tool is actually doing.&lt;br /&gt;
&lt;br /&gt;
My hope is to attract more developers to work on the tools to make it easier to create better scenery for [[FlightGear]].&lt;br /&gt;
&lt;br /&gt;
== Toolchain ==&lt;br /&gt;
If you just want see every options/arguments available for each tool you can use this command line in the terragear/bin directory : (only for linux user)&lt;br /&gt;
  for file in *; do echo &amp;quot;&amp;quot; &amp;amp;&amp;amp; echo &amp;quot;###################################&amp;quot; &amp;amp;&amp;amp; echo $file &amp;amp;&amp;amp; echo &amp;quot;###################################&amp;quot; &amp;amp;&amp;amp; ./$file --help; done&lt;br /&gt;
or alternatively&lt;br /&gt;
  find * -exec bash './{}' '--help' \;&lt;br /&gt;
&lt;br /&gt;
=== gdalchop ===&lt;br /&gt;
&lt;br /&gt;
gdalchop is a tool responsible for cropping height data files into SimGear buckets (or tiles).&lt;br /&gt;
&lt;br /&gt;
Most height data is published in fairly large data files that cover 1 square degree.  For SRTM-1 data, there are 3601 x 3601 data points per file.  For SRTM-3 data, there are 1201 x 1201 data points per file.  SRTM datafiles are named by their southwestern most point.&lt;br /&gt;
&lt;br /&gt;
When TerraGear tools need to query elevation data, they do so expecting the data to be located in a standard SimGear folder structure as follows:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Format !! Example&lt;br /&gt;
|-&lt;br /&gt;
|''10 deg x 10 deg folder''|| ''w070n10''&lt;br /&gt;
|-&lt;br /&gt;
|— ''1 degree by 1 degree subfolder  ''||— ''w065n17''&lt;br /&gt;
|-&lt;br /&gt;
|—— ''bucket file  ''||—— ''1891048.arr.gz  ''&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
gdalchop will create this directory structure in the work folder, and create sgbucket.arr.gz files within.&lt;br /&gt;
&lt;br /&gt;
==== command options ====&lt;br /&gt;
gdalchop  &amp;lt;work dir&amp;gt; &amp;lt;height data dir&amp;gt;/*hgt&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;work_dir&amp;gt;'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This is where gdalchop will generate the elevation directory structure described above.&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;height data dir&amp;gt;'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This is the directory your height data resides in.  (i.e. .hgt files for SRTM)&lt;br /&gt;
&lt;br /&gt;
'''&amp;lt;height data dir&amp;gt;/*hgt'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Points to all the hgt files in the data directory&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== notes ====&lt;br /&gt;
# remember to use gdalchop on directories, rather than individual files.  It handles height data stitching for you.  Using individual files will produce data with missing elevation data where stitching could not be performed.&lt;br /&gt;
&lt;br /&gt;
For example, this command will process all the .hgt file from the folder &amp;quot;SRTM-source&amp;quot; and the result will go in the folder &amp;quot;work/SRTM3&amp;quot;&lt;br /&gt;
 gdalchop work/SRTM3 SRTM-source/*hgt&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== hgtchop (deprecated) ===&lt;br /&gt;
hgtchop is also a too responsible for cropping height data files into SimGear buckets (or tiles).  This tool only work with data in the .hgt format (SRTM, viewfinder).  &lt;br /&gt;
&lt;br /&gt;
Reasons for using gdalchop:&lt;br /&gt;
* handles heightdata in many more formats&lt;br /&gt;
* is based on gdal, an actively maintained open source GIS library&lt;br /&gt;
&lt;br /&gt;
==== command options ====&lt;br /&gt;
hgtchop &amp;lt;resolution&amp;gt; &amp;lt;hgt_file&amp;gt; &amp;lt;work_dir&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''resolution'''&amp;lt;br /&amp;gt;&lt;br /&gt;
Each file created contains ALL of the data points for the simgear tile. For SRTM-1 data, the resultant grid (for tiles near the equator) is 450 x 450 points.  For SRTM-3 data, the grid is 150 x 150 points.  The resolution parameter tells hgtcop the distance between sampled points.  Note that tile width varies with latitude.  So 'square' tiles really only exist between 22 degrees N - 22 degrees S.  The tile widths are explained here: [[Tile_Index_Scheme|Tile Index Scheme]] &lt;br /&gt;
&lt;br /&gt;
'''hgt_file'''&amp;lt;br /&amp;gt;&lt;br /&gt;
The source file. Usually, the source files are 1 degree by 1 degree, and have enough data to create 64 simgear buckets (near the equator).&lt;br /&gt;
&lt;br /&gt;
'''work_dir'''&amp;lt;br /&amp;gt;&lt;br /&gt;
This is where hgt-chop will generate the elevation directory structure described above.&lt;br /&gt;
&lt;br /&gt;
==== notes ====&lt;br /&gt;
#zip files : In TGHgt::open, if the file extension is '.zip', then unzip executable is executed through system().  If the host system doesn't have unzip, then hgtchop will fail.  The unzip should be performed via SimGear - Investigation needed&amp;lt;br /&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== terrafit ===&lt;br /&gt;
&lt;br /&gt;
terrafit is responsible for taking the raw heightfield data for one bucket, and picking the most important points to generate a triangle mesh.  It uses [http://mgarland.org/archive/cmu/scape/terra.html Terra] to perform the work.  The output is not a triangulation, but rather a list of nodes that can be fed to a triangulation routine.  The quality of FlightGear's terrain is directly related to what parameters are fed into terrafit.&lt;br /&gt;
&lt;br /&gt;
==== command options ====&lt;br /&gt;
terrafit [options] &amp;lt;file | path&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Option !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| -m ''or'' --minnodes||50||smallest number of nodes to produce.  For a mostly flat tile, more nodes are wasteful.&lt;br /&gt;
|-&lt;br /&gt;
| -x ''or'' --maxnodes||1000||largest number of nodes to produce.&amp;lt;br /&amp;gt;&lt;br /&gt;
For a very complex tile, limiting this will reduce the detail of the resulting mesh.&lt;br /&gt;
|-&lt;br /&gt;
| -e ''or'' --maxerror||40||While picking points, and we have at least minnodes, but not yet maxnodes, the mesh will be completed&amp;lt;br /&amp;gt;&lt;br /&gt;
if any of the remaining points maximum elevation error drops below this value.&lt;br /&gt;
|-&lt;br /&gt;
| -f ''or'' --force|| ||If you have an already fitted work directory, and want to regenerate with different parameters, be sure to use force.&amp;lt;br /&amp;gt;&lt;br /&gt;
Otherwise, the work directory is checked for updated height data and merged with current data&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
As you can see, the default parameters are pretty conservative.  At most, we will output 1,000 nodes.  The input data for SRTM-1 contains 202,500 nodes, so we are only keeping 0.5% of the source data (or for SRTM-3, with 22,500 nodes, we keep ~5% of the source data)  &lt;br /&gt;
&lt;br /&gt;
For my experiments, I've increased maxnodes to 20,000, and decreased max error to 10 meters, and didn't see a major frame rate hit).&lt;br /&gt;
&lt;br /&gt;
If you consider the number of nodes added when using detailed landclass, it's unfortunate that the height lookup for these points will be based on such an inaccurate mesh.&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, this command will process all the *.arr.gz file (previously generated with gdalchop) from the folder &amp;quot;work/SRTM3&amp;quot;, the result will go among .arr.gz files&lt;br /&gt;
 terrafit -f -m 50 -x 20000 -e 10 work/SRTM3&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== ogr-decode ===&lt;br /&gt;
&lt;br /&gt;
ogrdecode is responsible for decoding landclass and line vector data into terragears internal textured polygon format.  It also performs the 'chop' operation, so the output is structured in the same directory format as described in gdalchop.  ogr-decode is capable of decoding shapefiles stored on disk, or retrieving the data from a PosGIS database.&lt;br /&gt;
&lt;br /&gt;
==== command options ====&lt;br /&gt;
ogr-decode [options...] &amp;lt;work dir&amp;gt; &amp;lt;datasource&amp;gt; [&amp;lt;layername&amp;gt;...]&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Option !! Default !! Description&lt;br /&gt;
|-&lt;br /&gt;
| --line-width||50||for line data, this is the width in meters the generated polygons will be.&lt;br /&gt;
|-&lt;br /&gt;
| --line-width-column||''none''||for line data, this optional field can be used to retrieve the width from the database row, under the given column.&amp;lt;br /&amp;gt;&lt;br /&gt;
If data is present in the row, it overrides the line-width parameter.&lt;br /&gt;
|-&lt;br /&gt;
| --point-width||500||for point data, this is the 'width' of the square generated.  Both width and height will be this large.&lt;br /&gt;
|-&lt;br /&gt;
| --point-width-column||''none''||for point data, this optional field can be used to retrieve the width from the database row, under the given column.&amp;lt;br /&amp;gt;&lt;br /&gt;
If data is present in the row, it overrides the point-width parameter.&lt;br /&gt;
|-&lt;br /&gt;
| --area-type||Default||This string is used to define the type of landclass the generated polygons will be saved under.&amp;lt;br /&amp;gt;&lt;br /&gt;
In tgconstruct, the landclass priorities file is used to determine the priority of each landclass.  higher priorities are 'on top' of lower.&amp;lt;br /&amp;gt;&lt;br /&gt;
The name given here must match a landclass type in your priorities configuration file.&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
=== genapts / genapts850 ===&lt;br /&gt;
&lt;br /&gt;
The general approach that genapts uses this. Start with a simple square polygon representing the airport area. As we proceed and add shapes to the airport, they are subtracted from this initial polygon. Also start with an empty polygon representing the airport shapes. As we proceed, objects are &amp;quot;added&amp;quot; to this polygon. Then we iterate through all the runways and taxiways for the airport. For each 8.10 taxiway we draw the corresponding box. We &amp;quot;intersect&amp;quot; that box with the accumulated shape polygon, so we can only cover areas that haven't been covered already. Then we add this &amp;quot;intersected&amp;quot; shape to the airport shape polygon and subtract it from the enclosing polygon. We get to pick the order we process the airport surface objects, so we pick the runways first, and probably the biggest runways before the smaller runways. Then the bigger taxiways before the littler taxiways, etc. Biggest/most important to smallest, least important. In the end we have a jigsaw puzle of all the individual shapes (so we can texture them properly individually) as well as a master surrounding polygon with holes cut out for all the shapes, plus a master polygon of all the shapes. Then in the end we can cover the whole area perfectly with no overlaps and no seams. In addition, there is a fairly sophisticated (and I think cool) step where we fit a natural curved surface across the airport elevation and used the curved surface instead of raw SRTM points. This eliminates the &amp;quot;noise&amp;quot; in the raw data and gives the airport surface a natural looking slope and correct hills and valleys (in most cases.) After that we generate all the light points and adjust their height based on the fitted curved surface. I think this approach could be updated for the 8.5 format by just generating different polygon shapes instead of the older collection of rectangles. The down side to the current approach is that it's hard to add markings over the surface. Without getting into all the technical details, if you cut in the markings into the surface structure you end up with an incredibly complex shape with an incredible number of triangles. Bad for load speeds and rendering speeds. If you lay the runway / taxiway markings and skid marks over the top of the base surface, then you have a lot of issues with z-buffer fighting and other odd graphics artifacts. Because our runway surface is curved/sloped we just use a simple draw order trick like other sims might use. But maybe in the past few years people have developed better tricks and techniques for handling this difficult problem of adding complex / arbitrary markings to a surface in a way that looks good mostly edge on (when landing or taxiing) and doesn't blow up your polygon count or encounter z-buffer problems, or require odd hacks of lifting the markings high enough above the runway that you can start to see that they are actually floating and not attached. &amp;lt;ref&amp;gt; {{cite web&lt;br /&gt;
  | url    = http://sourceforge.net/p/flightgear/mailman/message/28066427/&lt;br /&gt;
  | title  = &amp;lt;nowiki&amp;gt;Re: [Flightgear-devel] New experimental mapserver&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | author = &amp;lt;nowiki&amp;gt;Curtis Olson&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  | date   = Sep 9th, 2011&lt;br /&gt;
  | added   = Sep 9th, 2011&lt;br /&gt;
  | script_version = 0.25&lt;br /&gt;
  }}&lt;br /&gt;
&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== design ====&lt;br /&gt;
:Step 1 : Parse&lt;br /&gt;
&lt;br /&gt;
:Step 2 : Clip&lt;br /&gt;
&lt;br /&gt;
:Step 3 : Clean&lt;br /&gt;
&lt;br /&gt;
:Step 4 : Elevation&lt;br /&gt;
&lt;br /&gt;
:Step 5 : Output&lt;br /&gt;
&lt;br /&gt;
=== fgfs-construct ===&lt;br /&gt;
&lt;br /&gt;
== Related content ==&lt;br /&gt;
* [[Using Terragear]]&lt;br /&gt;
* [[Howto:Use TerraGear without wanting to kill yourself]]&lt;br /&gt;
* [[TerraGear CORINE]]&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
{{Building}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Scenery enhancement]]&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=TerraGear&amp;diff=133513</id>
		<title>TerraGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=TerraGear&amp;diff=133513"/>
		<updated>2021-10-14T18:20:16Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: /* Related content */ Add new guide&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hatnote|Not to be confused with [[TerraSync]], a tool to download scenery on-the-fly.}}&lt;br /&gt;
&lt;br /&gt;
[[File:TerraGear The Hague wireframe.png|thumb|270px|A wireframe view of detailed [[CORINE]] and [[OSM]] scenery, generated by TerraGear.]]&lt;br /&gt;
'''TerraGear''' is a collection of open-source tools and rendering libraries which can transform publically available GIS data in 3D representations (i.e. 3D models or 3D maps) of the earth for use in real time rendering projects. TerraGear can import 3D data sets such as DEM terrain grids, 2D polygon data sets such as coastlines, city outlines, lake outlines, and 2D raster data sets such as the 1 km NAOO land use/land cover data. It also has tools for generating realistic [[airport]]s, runways, and lighting based on available FAA data. &lt;br /&gt;
&lt;br /&gt;
TerraGear is the primary tool used to generate the [[scenery]] for the [[FlightGear]] project. &lt;br /&gt;
&lt;br /&gt;
Without terragear, it is possible to change Terrain '''textures''' but not terrain '''shapes'''. If you want to change the texture for cities, you change the materials file. If you want to change the coast line, you need terragear.&lt;br /&gt;
Check the material files in directory FGDATA/Material. Identify the material file that includes Montevideo, which is probably latin_american_cities.xml ([[Howto:Regional texturing]] and this page [[Procedural Texturing]]&amp;lt;ref&amp;gt;{{cite web&lt;br /&gt;
  |url    =  https://forum.flightgear.org/viewtopic.php?p=311143#p311143 &lt;br /&gt;
  |title  =  &amp;lt;nowiki&amp;gt; Re: Improving terrain realism &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |author =  &amp;lt;nowiki&amp;gt; ludomotico &amp;lt;/nowiki&amp;gt; &lt;br /&gt;
  |date   =  May 25th, 2017 &lt;br /&gt;
  |added  =  May 25th, 2017 &lt;br /&gt;
  |script_version = 0.40 &lt;br /&gt;
  }}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
For a variety of reasons you might want to build terrain yourself, rather than downloading it from the available scenery on FlightGear. For instance, if you use [[WED]] to create or modify an airport layout, you might wish to see how that modified airport would look in the Scenery before deciding you're happy with the results. And normally, to see and use the airport in the scenery, it's necessary to submit the modifications to the FlighGear scenery staff and then wait untill the next update of the scenery of that area is available via [[TerraSync]] or in the [http://www.flightgear.org/download/scenery/ official FlightGear Scenery] build. If you can build terrain yourself, you can start using it right away.&lt;br /&gt;
&lt;br /&gt;
Maybe the official scenery is too detailed for your slow machine, and you'd like to build terrain using a digital elevation model (DEM) with poorer resolution, to decrease the number of polygons and thus improve your framerates. Or maybe you've got a fantastically fast machine, and you want to build your own terrain using higher resolution vector data (vmap1, Tiger) to get better roads/rivers. For all these reasons learning how to use TerraGear is a good idea.&lt;br /&gt;
&lt;br /&gt;
== Getting TerraGear ==&lt;br /&gt;
=== Using the download_and_compile.sh script (Linux distros using apt) ===&lt;br /&gt;
Get the script download_and_compile.sh if you don't already have it. Copy it into a specific directory, no need to be root.&lt;br /&gt;
{{#tag: syntaxhighlight |&lt;br /&gt;
wget {{fgmeta url|view=raw|path=download_and_compile.sh}}&lt;br /&gt;
mv download_and_compile.sh\?format\=raw download_and_compile.sh&lt;br /&gt;
chmod 755 download_and_compile.sh&lt;br /&gt;
./download_and_compile.sh SIMGEAR TERRAGEAR&lt;br /&gt;
| lang=&amp;quot;bash&amp;quot;&lt;br /&gt;
}}&lt;br /&gt;
This will build SIMGEAR (pre-requisite) and TERRAGEAR properly, installing dependencies if necessary and you will be done for the TG compilation part of the process.&lt;br /&gt;
&lt;br /&gt;
=== Pre-compiled builds ===&lt;br /&gt;
* [http://build.flightgear.org:8080/job/TerraGearGUI-Win/lastSuccessfulBuild/artifact/*zip*/archive.zip Latest Windows build], built by the [[FlightGear Build Server]].&lt;br /&gt;
&lt;br /&gt;
:*[[TerraGear_Installation_for_Windows|Detailed Windows Installation Instructions]]&lt;br /&gt;
&lt;br /&gt;
=== Source ===&lt;br /&gt;
The source is hold in a [[Git]] repository at SourceForge..&lt;br /&gt;
{{#tag: syntaxhighlight |&lt;br /&gt;
{{terragear clone|post=flightgear-terragear}}&lt;br /&gt;
| lang=&amp;quot;bash&amp;quot;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
you have to use the stable branch called &amp;quot;scenery/ws2.0&amp;quot;!&lt;br /&gt;
{{terragear url|branch=scenery/ws2.0/~}}&lt;br /&gt;
&lt;br /&gt;
== Compilation ==&lt;br /&gt;
=== Dependencies ===&lt;br /&gt;
* TerraGear&lt;br /&gt;
** [[SimGear]] - '''Not''' simgear-cs! (simgear-dev package)&lt;br /&gt;
*** SimGear can be compiled without OSG support thus eliminating many deps, like OSG. Use &amp;quot;-DSIMGEAR_HEADLESS=YES&amp;quot; for a minimal build.&lt;br /&gt;
** [http://www.cgal.org/ CGAL] - For high accuracy geometric calculations&lt;br /&gt;
** [http://www.gdal.org/ libgdal]&lt;br /&gt;
&lt;br /&gt;
=== Building ===&lt;br /&gt;
 cmake . [options]  &lt;br /&gt;
 make install&lt;br /&gt;
&amp;lt;tt&amp;gt;cmake&amp;lt;/tt&amp;gt; options:&lt;br /&gt;
 -DCMAKE_PREFIX_PATH=&amp;quot;/path/to/lib/install/prefix&amp;quot;&lt;br /&gt;
&lt;br /&gt;
=== Platform specific ===&lt;br /&gt;
==== Debian ====&lt;br /&gt;
* [[Building FlightGear - Debian#TerraGear]]&lt;br /&gt;
==== Gentoo ====&lt;br /&gt;
* emerge -av terragear&amp;lt;/tt&amp;gt;&lt;br /&gt;
See [[Building Flightgear - Gentoo]].&lt;br /&gt;
==== Ubuntu ====&lt;br /&gt;
* [[Building terragear in Ubuntu 910 (32- or 64-bit)]]&lt;br /&gt;
* [[TerraGear compilation - Ubuntu 14.04]]&lt;br /&gt;
&lt;br /&gt;
== GUI Tool ==&lt;br /&gt;
A [[TerraGear GUI]] is available for those that would like to use TerraGear without knowing/using the command line options.&lt;br /&gt;
&lt;br /&gt;
== Related content ==&lt;br /&gt;
* [[Using Terragear]]&lt;br /&gt;
* [[Howto:Use TerraGear without wanting to kill yourself]]&lt;br /&gt;
* [[TerraGear CORINE]]&lt;br /&gt;
* [[TerraGear Documentation]]&lt;br /&gt;
* [http://api-docs.freeflightsim.org/terragear/ TerraGear API docs]&lt;br /&gt;
&lt;br /&gt;
{{Terra}}&lt;br /&gt;
{{Building}}&lt;br /&gt;
&lt;br /&gt;
[[Category:TerraGear]]&lt;br /&gt;
&lt;br /&gt;
[[es:TerraGear]]&lt;br /&gt;
[[fr:TerraGear]]&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133512</id>
		<title>Howto:Use TerraGear without wanting to kill yourself</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133512"/>
		<updated>2021-10-14T18:08:12Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: Adding to category&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My aim was to go through this whole process successfully with as little manual labour (don’t have the knowledge to go fine tuning in QGIS? no problem! neither did I) as possible. &amp;quot;Automation ftw&amp;quot; has been my perspective entering this endeavour.&lt;br /&gt;
&lt;br /&gt;
Special thanks to some brilliant lads who walked these roads long before I did, for helping me discover the way! Shoutout [[User:Fahim Dalvi|Fahim]], [[User:D-ECHO|D-ECHO]], and [[User:Legoboyvdlp|legoboyvdlp]], among several others (you know who you are) – in fact, big up the whole FG community.&lt;br /&gt;
&lt;br /&gt;
Hopefully, some of you will find this guide helpful – though at the time of writing, it appears that TerraGear is on the verge of becoming obsolete any minute now. So, if nothing else, it can serve as a time capsule of sorts – a way of recollecting how this task used to be done. Cheers! –– [[User:IskenderWang|IskenderWang]] ([[User talk:IskenderWang|talk]])&lt;br /&gt;
&lt;br /&gt;
== Directory structure ==&lt;br /&gt;
&lt;br /&gt;
Inside your working directory for TerraGear you will simply need three subdirectories – one for your starting '''data''' which you will process as necessary, one for the '''work''' that the TG tools will achieve which provides it with the actual recipe for constructing your scenery, and one for the '''output''' or end product after running tg-construct (the final step) to generate your terrain. My directory structure in the midst of generating several sceneries was looking as pictured.&lt;br /&gt;
&lt;br /&gt;
[[File:TG directory structure.png|thumb|right|A directory format one could expect to utilize while working with TG]]&lt;br /&gt;
&lt;br /&gt;
As you can see, what I like to do is compartmentalise the various sceneries I’ve created/aim to create in their own subdirectories in ''/data'' so to prevent any confusion and easily keep them separate them as I use the TG tools. Since you’re generating terrain one at a time though, I’d strongly recommend clearing out your ''/work'' directory completely in between each.&lt;br /&gt;
&lt;br /&gt;
== Gather all the necessary starting data ==&lt;br /&gt;
&lt;br /&gt;
The materials you will need to embark on your TG journey are:&lt;br /&gt;
# '''Elevation data''': Numerous sources for that but the best option will probably still be [http://viewfinderpanoramas.org/dem3.html viewfinderpanorama].&lt;br /&gt;
# '''All the airports in the area you aim to build''': Best to use some tool like [[TerraMaster]] for this, but keep in mind that Docker TG (even running terragear:latest) seems to only support up to XP apt.dat version 1100 – it unfortunately won’t work with 1130 which is the version most of the latest and greatest airports on [https://gateway.x-plane.com the gateway] will come with, whereas if you compiled the latest TG you should be all good in this respect.&lt;br /&gt;
# '''[https://osmdata.openstreetmap.de/download/land-polygons-complete-4326.zip World landmass polygon]''': This is great since it serves as your base layer and also has very accurate coastlines.&lt;br /&gt;
# '''Shapefiles''': This is where things get interesting, there are numerous sources one can defer to. In the past, people mainly relied on vmap0 and there was a nice mapserver that made it easy to acquire. Nowadays, the mapserver’s gone by the looks of it. Today, while you can still choose [https://gis-lab.info/qa/vmap0-eng.html vmap0], far better options exist for most areas nowadays thanks to the availability of [https://download.geofabrik.de OSM shapefiles] (solid option almost anywhere these days) as well as [[Coordination of Information on the Environment|CORINE]] (Europe), [[Howto:Using QGIS to process NLCD data|NLCD]] (U.S.), and [[User:D-ECHO/Canada Land Cover|LCC]] (Canada), though these others can be a bit less straightforward to obtain and work with – thankfully, if you’d like to try them out there’s documentation for all of those supplied by some top blokes in the FG community.&lt;br /&gt;
&lt;br /&gt;
== Process your elevation data ==&lt;br /&gt;
&lt;br /&gt;
When you unpack your elevation data, make sure to somehow place ALL the hgt files you intend to use in the relevant folder for the scenery in question, with no subdirectories dividing them – using &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; and the wildcard to move all the contents of the needed folders from VFP to where they belonged worked just fine for me; quick and efficient.&lt;br /&gt;
&lt;br /&gt;
For only this step, you could use this command: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:ws20 /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is guaranteed to not have buggy elevation tools, so it’s really your call – you could do it just in case, especially if you’re working exclusively with Docker.&lt;br /&gt;
&lt;br /&gt;
 for f in ${PWD}/data/SRTM-3/scenery-in-question/*.hgt; do hgtchop 3 &amp;quot;${f}&amp;quot; &amp;quot;${PWD}/work/SRTM-3&amp;quot;; done&lt;br /&gt;
 terrafit work/SRTM-3&lt;br /&gt;
&lt;br /&gt;
Now for everything else: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:latest /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Process your airports ==&lt;br /&gt;
&lt;br /&gt;
Once you’ve collected all your airports from the gateway and you’re confident that they’ll work with genapts (perhaps through trial and error) you can just place all the zips in a burner directory and create an airports directory inside of that – then if you have zsh you can simply run my script here in the command line:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/zsh&lt;br /&gt;
 for file in *.zip&lt;br /&gt;
   do&lt;br /&gt;
     FILENAME=$( echo $file | sed s/.zip// )&lt;br /&gt;
     ICAO=$( echo $file | sed s/_Scenery_Pack.zip// )&lt;br /&gt;
     unzip $file&lt;br /&gt;
     cd $FILENAME/&amp;quot;Earth nav data&amp;quot;&lt;br /&gt;
     mv apt.dat ../../airports/$ICAO.dat&lt;br /&gt;
     cd ../..&lt;br /&gt;
     trash $FILENAME&lt;br /&gt;
   done&lt;br /&gt;
 trash ./*zip&lt;br /&gt;
&lt;br /&gt;
and there you have it – all your .dat’s are there and sorted correctly by ICAO, which you can then transfer to your TG ''/data/airports'' folder.&lt;br /&gt;
&lt;br /&gt;
Another way which is even better in a perfect world is to cut out the middleman by using the [https://github.com/mherweg/d-laser-fgtools dlaser tools], however this will always fetch the latest ones, which may not work for you if you’re using Docker TG.&lt;br /&gt;
&lt;br /&gt;
Either way, this step may or may not be cumbersome depending on the amount of ''.dat'' files you’ll need, which can often include not just airports and airfields but also other things such as helipads – for instance, my Hong Kong scenery needed only 5 in total, while 12 tiles of scenery for Florida required 177 (!!) rasclart .dat files, which meant that using the ''gateway_pull.py'' script was a must (you'll need to run it through Python 2 though).&lt;br /&gt;
&lt;br /&gt;
Then, once you’re ready, simply run this command:&lt;br /&gt;
&lt;br /&gt;
 for i in ./data/airports/scenery-in-question/*.dat; do genapts850 --threads --input=$i --work=./work --dem-path=SRTM-3; done&lt;br /&gt;
&lt;br /&gt;
== Determine your bounding box coordinates ==&lt;br /&gt;
&lt;br /&gt;
You may have already done this step in the very beginning, but if not, now would be a good time.&lt;br /&gt;
'''Think of the corners as bottom left, upper right, longitude BEFORE latitude.'''&lt;br /&gt;
&lt;br /&gt;
In my case, for the Hong Kong scenery, the relevant coordinates were &amp;lt;code&amp;gt;113 21&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;115 23&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Crop your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Before we dive more deeply into shapefiles, an important thing to mention is that while the .shp files will be the “stars of the show” in a sense, many of the other files it will come with are also NECESSARY! This means you should not try to delete files that may have seemed redundant to the uninitiated (i.e. me, at that point), and that if you’re going to move shapefiles between directories you’ll have to copy/move ALL of the ones that you will need which come in a set (by having the same filename, just different extensions). After all, most of those other files are there for a good reason, and not just to provide alternative options for GIS users as I had initially assumed. This had me stumped for a little while, wondering why this next tool wasn’t working and almost concerned that I wouldn’t be able to advance beyond this step, UNTIL I came across [https://gis.stackexchange.com/questions/262505/python-cant-read-shapefile/262509 this post on Stack Exchange] and it all made sense, so big up Michael Stimson as well for the helpful answer.&lt;br /&gt;
&lt;br /&gt;
Something to note so that you don’t have to make that same mistake :) First, make sure you're inside ''/data/shapefiles'' (run a quick &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; if not). Then, we simply run:&lt;br /&gt;
&lt;br /&gt;
 ogr2ogr -clipsrc 113 21 115 23 hk.shp land_polygons.shp&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the others as well – you can even use colons to run them all in one go, as I did. Be patient, though, because if your initial region &amp;amp; shapefiles are large then it can take longer than you may have expected at first.&lt;br /&gt;
&lt;br /&gt;
== Split your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
At this point, you can put your cropped project shapefiles in their own directory and then delete or keep the full shapefiles depending on if you intend to use them again or not – that said, you should probably keep the land polygons (default) shapefile for future use since it can act as the base for the whole world, but for your cropped landmass shapefile for THIS scenery you can make a separate directory. I called mine simply “landmass” and now it may look something like what you see in the screenshot.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles folder.png|thumb|center|The directory for shapefiles and how it could look at the extraction/splitting step]]&lt;br /&gt;
&lt;br /&gt;
Here is Fahim's wonderful script, which allows us to perform this step:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # Check arguments&lt;br /&gt;
 if [ $# -lt 2 ]; then&lt;br /&gt;
     echo &amp;quot;Usage: bash extract_features_shapefile.sh &amp;lt;path-to-shapefile&amp;gt; &amp;lt;path-to-output-dir&amp;gt;&amp;quot;&lt;br /&gt;
     exit&lt;br /&gt;
 fi&lt;br /&gt;
 src_shp=$1&lt;br /&gt;
 dest_dir=$2&lt;br /&gt;
 # Extract available feature list in supplied shapefile&lt;br /&gt;
 echo &amp;quot;Extracting available features...&amp;quot;&lt;br /&gt;
 feature_list=$(ogrinfo -al $src_shp | grep 'fclass (String)' | tr -s ' ' | cut -d' ' -f5 | sort | uniq)&lt;br /&gt;
 echo &amp;quot;Found following features:&amp;quot;&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo $feat&lt;br /&gt;
 done&lt;br /&gt;
 # Create shapefile per feature from supplied shapefile&lt;br /&gt;
 echo &amp;quot;Creating new shapefiles...&amp;quot;&lt;br /&gt;
 mkdir -p $dest_dir&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo &amp;quot;Processing $feat...&amp;quot;&lt;br /&gt;
     mkdir -p $dest_dir/osm_$feat&lt;br /&gt;
     ogr2ogr -where &amp;quot;FCLASS LIKE '&amp;quot;$feat&amp;quot;'&amp;quot; $dest_dir/osm_$feat/osm_$feat.shp $src_shp&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
Now you can use it on each of your shapefiles in the project directory, like this:&lt;br /&gt;
&lt;br /&gt;
 bash extract_features_shapefile.sh hk/gis_osm_landuse_a_free_1-hk.shp .&lt;br /&gt;
&lt;br /&gt;
and so on.&lt;br /&gt;
&lt;br /&gt;
This step prepares us to translate each of the specific types of land classes we need to the FlightGear format, as defined by Material definitions, while also deciding which ones to prune – bear in mind that many of these we can (and should) exclude because leaving them in the final recipe would add too much complexity.&lt;br /&gt;
&lt;br /&gt;
== Map and decode your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Once you reach this stage, you may now have a shit-ton of directories – that was certainly the case for me, as the screenshot illustrates.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles split.png|thumb|center|Oh my, that seems like a lot]]&lt;br /&gt;
&lt;br /&gt;
Not to fear – the light at the end of this tunnel is in sight already. Now we have to do something called [[OSM to materials mapping|mapping]], which is basically the translation I mentioned earlier, and then run ALL these inputs through the TG tool called ogr-decode.&lt;br /&gt;
&lt;br /&gt;
This step can be time-consuming: deciding what to exclude [from the decoding step], and how to map the landclasses you do include.&lt;br /&gt;
You don’t need expertise in QGIS by any means – however, it can certainly come in handy with helping you view all your split shapefiles by importing them in and then tinkering with the layer visibilities to decide on what you don’t need/would add too much complexity versus what is necessary, because remember, performance in FG is of the essence as well (always keep that in mind during this step).&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 1.png|thumb|right|Obviously we'd never need all this, that's why we had further split up these shapefiles]]&lt;br /&gt;
&lt;br /&gt;
'''BRO TIP''': I didn’t realise this myself at first as a n00b to the toolkit, but I was advised by legoboyvdlp that osm_unclassified actually includes numerous roads and isn’t as irrelevant as the name would suggest, in fact it’s better to include this and PRUNE osm_residential for improved performance.&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 2.png|thumb|left|Here you can see a big difference, not to mention I also ended up pruning the selected osm_residential landclass]]&lt;br /&gt;
&lt;br /&gt;
When you map, try to use more standard landclass names as much as possible since those cover mostly everything – unless you have something specific in mind (such as for a custom scenery with its own set of material definitions), try to avoid using any landclasses that aren’t even mentioned in the [https://sourceforge.net/p/flightgear/terragear/ci/next/tree/src/BuildTiles/Main/default_priorities.txt default priorities file].&lt;br /&gt;
That said, if you insist on using other landclasses for whatever reason, you can always create your custom priorities file and add your own landclasses to it, and then just tell tg-construct to use that instead.&lt;br /&gt;
We’ll likely be doing this in bulk, so it makes a ton of sense to create a script for this (shoutout to D-ECHO who I would say has championed this approach) and place it in the TOP level of the TG working directory (so it’s level with ''/data'', ''/work'', ''/output'').&lt;br /&gt;
&lt;br /&gt;
Then, all the arguments will essentially follow this sort of format exactly:&lt;br /&gt;
&lt;br /&gt;
 ogr-decode --max-segment 500 --area-type Default work/Default data/shapefiles/landmass/&lt;br /&gt;
 ogr-decode --max-segment 500 --line-width 12 --area-type Asphalt work/Asphalt data/shapefiles/osm_motorway/&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the other landclasses, hoping you’ve mapped it all correctly.&lt;br /&gt;
So once that’s set, you simply run the script:&lt;br /&gt;
&lt;br /&gt;
 ./decode_osm_data.sh&lt;br /&gt;
&lt;br /&gt;
(note: if you're doing it like this make sure it’s executable first, a quick &amp;lt;code&amp;gt;chmod +x&amp;lt;/code&amp;gt; may come in handy – I like to do this here instead of invoking bash because when I was on Ubuntu in a zsh shell it may have been more efficient for it to simply work through the same shell, entirely up to your preference though)&lt;br /&gt;
&lt;br /&gt;
== Generate your terrain ==&lt;br /&gt;
&lt;br /&gt;
At long last! This step requires us to use the final utility in the TG workflow, &amp;lt;code&amp;gt;tg-construct&amp;lt;/code&amp;gt;, and I like to use a modified version of D-ECHO’s script for this as well:&lt;br /&gt;
&lt;br /&gt;
 ./tg-construct.sh&lt;br /&gt;
&lt;br /&gt;
In my case, the one command I was truly running was as follows:&lt;br /&gt;
&lt;br /&gt;
 tg-construct --work-dir=./work --output-dir=./output/Terrain --min-lon=113 --max-lon=115 --min-lat=21 --max-lat=23 --threads=3 --priorities=/usr/local/share/TerraGear/default_priorities.txt AirportArea SRTM-3 AirportObj Default Ocean Hole Road-Motorway Road-Trunk Road-Residential Road-Primary Road-Secondary Road-Tertiary Road-Service Road-Pedestrian Road-Steps Road-Unclassified Airport Pond Lake DryLake Reservoir IntermittentLake IntermittentStream Watercourse Canal Cliffs Glacier PackIce PolarIce Ocean Estuary Urban SubUrban Town Fishing Construction Industrial Port Dump FloodLand Lagoon Bog Marsh SaltMarsh Sand Saline Littoral Dirt Rock Lava OpenMining BuiltUpCover Transport Cemetery DryCrop IrrCrop Rice MixedCrop Vineyard Bamboo Mangrove ComplexCrop NaturalCrop CropGrass CropWood AgroForest Olives GolfCourse Greenspace GrassCover Grassland ScrubCover Scrub ShrubGrassCover SavannaCover Orchard DeciduousForest DeciduousBroadCover EvergreenForest EvergreenBroadCover MixedForest RainForest BarrenCover HerbTundra Sclerophyllous Heath Burnt SnowCover Island Default Void Null Unknown River Freeway Road Asphalt Railroad Stream&lt;br /&gt;
&lt;br /&gt;
When I changed computers, the only thing I had to alter here was the thread count and the path to the default priorities file.&lt;br /&gt;
&lt;br /&gt;
Now just sit back n relax and enjoy everything, you feel me, because you know what’s about to happen.&lt;br /&gt;
&lt;br /&gt;
[[File:TG success.png|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
And have patience, because this could take a while! '''Seriously!!'''&lt;br /&gt;
For legoboyvdlp, Ireland took a whole week (nonstop!!) to generate! And even for a relatively small scale such as Hong Kong and some of the surrounding area, because the Pearl River Delta is rather dense and data-rich, it took me 24 hours on my 2017 Macbook Pro just for it to reach stage 2 (the second stage out of three, the last of which generates the BTG files), at which point it inexplicably killed the process! So I was left with no choice but to bring out the heavy artillery, and on my beefier rig (8 core CPU, running at 14 threads) at last I was able to complete the whole process in just about three hours (wow!) with Ubuntu in WSL, compiled from source using the download_and_compile script, followed by adding ''install/terragear/bin'' to my user &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt; (in .zshrc, for me) – this way, all the terragear tools can be called normally.&lt;br /&gt;
&lt;br /&gt;
So you see, the quickness of this step will depend entirely on a) the processing power at your disposal and b) the size and richness of the scenery you aim to generate. It may fail along the way for reasons you don’t understand – that’s OK, as long as you know you followed the process correctly just try again and most likely, it should work after some time.&lt;br /&gt;
&lt;br /&gt;
[[Category:TerraGear]]&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_Without_Wanting_to_Kill_Yourself&amp;diff=133511</id>
		<title>Howto:Use TerraGear Without Wanting to Kill Yourself</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_Without_Wanting_to_Kill_Yourself&amp;diff=133511"/>
		<updated>2021-10-14T18:02:14Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: IskenderWang moved page Howto:Use TerraGear Without Wanting to Kill Yourself to Howto:Use TerraGear without wanting to kill yourself: Sentence case preferred&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Howto:Use TerraGear without wanting to kill yourself]]&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133510</id>
		<title>Howto:Use TerraGear without wanting to kill yourself</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133510"/>
		<updated>2021-10-14T18:02:14Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: IskenderWang moved page Howto:Use TerraGear Without Wanting to Kill Yourself to Howto:Use TerraGear without wanting to kill yourself: Sentence case preferred&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My aim was to go through this whole process successfully with as little manual labour (don’t have the knowledge to go fine tuning in QGIS? no problem! neither did I) as possible. &amp;quot;Automation ftw&amp;quot; has been my perspective entering this endeavour.&lt;br /&gt;
&lt;br /&gt;
Special thanks to some brilliant lads who walked these roads long before I did, for helping me discover the way! Shoutout [[User:Fahim Dalvi|Fahim]], [[User:D-ECHO|D-ECHO]], and [[User:Legoboyvdlp|legoboyvdlp]], among several others (you know who you are) – in fact, big up the whole FG community.&lt;br /&gt;
&lt;br /&gt;
Hopefully, some of you will find this guide helpful – though at the time of writing, it appears that TerraGear is on the verge of becoming obsolete any minute now. So, if nothing else, it can serve as a time capsule of sorts – a way of recollecting how this task used to be done. Cheers! –– [[User:IskenderWang|IskenderWang]] ([[User talk:IskenderWang|talk]])&lt;br /&gt;
&lt;br /&gt;
== Directory structure ==&lt;br /&gt;
&lt;br /&gt;
Inside your working directory for TerraGear you will simply need three subdirectories – one for your starting '''data''' which you will process as necessary, one for the '''work''' that the TG tools will achieve which provides it with the actual recipe for constructing your scenery, and one for the '''output''' or end product after running tg-construct (the final step) to generate your terrain. My directory structure in the midst of generating several sceneries was looking as pictured.&lt;br /&gt;
&lt;br /&gt;
[[File:TG directory structure.png|thumb|right|A directory format one could expect to utilize while working with TG]]&lt;br /&gt;
&lt;br /&gt;
As you can see, what I like to do is compartmentalise the various sceneries I’ve created/aim to create in their own subdirectories in ''/data'' so to prevent any confusion and easily keep them separate them as I use the TG tools. Since you’re generating terrain one at a time though, I’d strongly recommend clearing out your ''/work'' directory completely in between each.&lt;br /&gt;
&lt;br /&gt;
== Gather all the necessary starting data ==&lt;br /&gt;
&lt;br /&gt;
The materials you will need to embark on your TG journey are:&lt;br /&gt;
# '''Elevation data''': Numerous sources for that but the best option will probably still be [http://viewfinderpanoramas.org/dem3.html viewfinderpanorama].&lt;br /&gt;
# '''All the airports in the area you aim to build''': Best to use some tool like [[TerraMaster]] for this, but keep in mind that Docker TG (even running terragear:latest) seems to only support up to XP apt.dat version 1100 – it unfortunately won’t work with 1130 which is the version most of the latest and greatest airports on [https://gateway.x-plane.com the gateway] will come with, whereas if you compiled the latest TG you should be all good in this respect.&lt;br /&gt;
# '''[https://osmdata.openstreetmap.de/download/land-polygons-complete-4326.zip World landmass polygon]''': This is great since it serves as your base layer and also has very accurate coastlines.&lt;br /&gt;
# '''Shapefiles''': This is where things get interesting, there are numerous sources one can defer to. In the past, people mainly relied on vmap0 and there was a nice mapserver that made it easy to acquire. Nowadays, the mapserver’s gone by the looks of it. Today, while you can still choose [https://gis-lab.info/qa/vmap0-eng.html vmap0], far better options exist for most areas nowadays thanks to the availability of [https://download.geofabrik.de OSM shapefiles] (solid option almost anywhere these days) as well as [[Coordination of Information on the Environment|CORINE]] (Europe), [[Howto:Using QGIS to process NLCD data|NLCD]] (U.S.), and [[User:D-ECHO/Canada Land Cover|LCC]] (Canada), though these others can be a bit less straightforward to obtain and work with – thankfully, if you’d like to try them out there’s documentation for all of those supplied by some top blokes in the FG community.&lt;br /&gt;
&lt;br /&gt;
== Process your elevation data ==&lt;br /&gt;
&lt;br /&gt;
When you unpack your elevation data, make sure to somehow place ALL the hgt files you intend to use in the relevant folder for the scenery in question, with no subdirectories dividing them – using &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; and the wildcard to move all the contents of the needed folders from VFP to where they belonged worked just fine for me; quick and efficient.&lt;br /&gt;
&lt;br /&gt;
For only this step, you could use this command: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:ws20 /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is guaranteed to not have buggy elevation tools, so it’s really your call – you could do it just in case, especially if you’re working exclusively with Docker.&lt;br /&gt;
&lt;br /&gt;
 for f in ${PWD}/data/SRTM-3/scenery-in-question/*.hgt; do hgtchop 3 &amp;quot;${f}&amp;quot; &amp;quot;${PWD}/work/SRTM-3&amp;quot;; done&lt;br /&gt;
 terrafit work/SRTM-3&lt;br /&gt;
&lt;br /&gt;
Now for everything else: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:latest /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Process your airports ==&lt;br /&gt;
&lt;br /&gt;
Once you’ve collected all your airports from the gateway and you’re confident that they’ll work with genapts (perhaps through trial and error) you can just place all the zips in a burner directory and create an airports directory inside of that – then if you have zsh you can simply run my script here in the command line:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/zsh&lt;br /&gt;
 for file in *.zip&lt;br /&gt;
   do&lt;br /&gt;
     FILENAME=$( echo $file | sed s/.zip// )&lt;br /&gt;
     ICAO=$( echo $file | sed s/_Scenery_Pack.zip// )&lt;br /&gt;
     unzip $file&lt;br /&gt;
     cd $FILENAME/&amp;quot;Earth nav data&amp;quot;&lt;br /&gt;
     mv apt.dat ../../airports/$ICAO.dat&lt;br /&gt;
     cd ../..&lt;br /&gt;
     trash $FILENAME&lt;br /&gt;
   done&lt;br /&gt;
 trash ./*zip&lt;br /&gt;
&lt;br /&gt;
and there you have it – all your .dat’s are there and sorted correctly by ICAO, which you can then transfer to your TG ''/data/airports'' folder.&lt;br /&gt;
&lt;br /&gt;
Another way which is even better in a perfect world is to cut out the middleman by using the [https://github.com/mherweg/d-laser-fgtools dlaser tools], however this will always fetch the latest ones, which may not work for you if you’re using Docker TG.&lt;br /&gt;
&lt;br /&gt;
Either way, this step may or may not be cumbersome depending on the amount of ''.dat'' files you’ll need, which can often include not just airports and airfields but also other things such as helipads – for instance, my Hong Kong scenery needed only 5 in total, while 12 tiles of scenery for Florida required 177 (!!) rasclart .dat files, which meant that using the ''gateway_pull.py'' script was a must (you'll need to run it through Python 2 though).&lt;br /&gt;
&lt;br /&gt;
Then, once you’re ready, simply run this command:&lt;br /&gt;
&lt;br /&gt;
 for i in ./data/airports/scenery-in-question/*.dat; do genapts850 --threads --input=$i --work=./work --dem-path=SRTM-3; done&lt;br /&gt;
&lt;br /&gt;
== Determine your bounding box coordinates ==&lt;br /&gt;
&lt;br /&gt;
You may have already done this step in the very beginning, but if not, now would be a good time.&lt;br /&gt;
'''Think of the corners as bottom left, upper right, longitude BEFORE latitude.'''&lt;br /&gt;
&lt;br /&gt;
In my case, for the Hong Kong scenery, the relevant coordinates were &amp;lt;code&amp;gt;113 21&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;115 23&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Crop your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Before we dive more deeply into shapefiles, an important thing to mention is that while the .shp files will be the “stars of the show” in a sense, many of the other files it will come with are also NECESSARY! This means you should not try to delete files that may have seemed redundant to the uninitiated (i.e. me, at that point), and that if you’re going to move shapefiles between directories you’ll have to copy/move ALL of the ones that you will need which come in a set (by having the same filename, just different extensions). After all, most of those other files are there for a good reason, and not just to provide alternative options for GIS users as I had initially assumed. This had me stumped for a little while, wondering why this next tool wasn’t working and almost concerned that I wouldn’t be able to advance beyond this step, UNTIL I came across [https://gis.stackexchange.com/questions/262505/python-cant-read-shapefile/262509 this post on Stack Exchange] and it all made sense, so big up Michael Stimson as well for the helpful answer.&lt;br /&gt;
&lt;br /&gt;
Something to note so that you don’t have to make that same mistake :) First, make sure you're inside ''/data/shapefiles'' (run a quick &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; if not). Then, we simply run:&lt;br /&gt;
&lt;br /&gt;
 ogr2ogr -clipsrc 113 21 115 23 hk.shp land_polygons.shp&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the others as well – you can even use colons to run them all in one go, as I did. Be patient, though, because if your initial region &amp;amp; shapefiles are large then it can take longer than you may have expected at first.&lt;br /&gt;
&lt;br /&gt;
== Split your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
At this point, you can put your cropped project shapefiles in their own directory and then delete or keep the full shapefiles depending on if you intend to use them again or not – that said, you should probably keep the land polygons (default) shapefile for future use since it can act as the base for the whole world, but for your cropped landmass shapefile for THIS scenery you can make a separate directory. I called mine simply “landmass” and now it may look something like what you see in the screenshot.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles folder.png|thumb|center|The directory for shapefiles and how it could look at the extraction/splitting step]]&lt;br /&gt;
&lt;br /&gt;
Here is Fahim's wonderful script, which allows us to perform this step:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # Check arguments&lt;br /&gt;
 if [ $# -lt 2 ]; then&lt;br /&gt;
     echo &amp;quot;Usage: bash extract_features_shapefile.sh &amp;lt;path-to-shapefile&amp;gt; &amp;lt;path-to-output-dir&amp;gt;&amp;quot;&lt;br /&gt;
     exit&lt;br /&gt;
 fi&lt;br /&gt;
 src_shp=$1&lt;br /&gt;
 dest_dir=$2&lt;br /&gt;
 # Extract available feature list in supplied shapefile&lt;br /&gt;
 echo &amp;quot;Extracting available features...&amp;quot;&lt;br /&gt;
 feature_list=$(ogrinfo -al $src_shp | grep 'fclass (String)' | tr -s ' ' | cut -d' ' -f5 | sort | uniq)&lt;br /&gt;
 echo &amp;quot;Found following features:&amp;quot;&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo $feat&lt;br /&gt;
 done&lt;br /&gt;
 # Create shapefile per feature from supplied shapefile&lt;br /&gt;
 echo &amp;quot;Creating new shapefiles...&amp;quot;&lt;br /&gt;
 mkdir -p $dest_dir&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo &amp;quot;Processing $feat...&amp;quot;&lt;br /&gt;
     mkdir -p $dest_dir/osm_$feat&lt;br /&gt;
     ogr2ogr -where &amp;quot;FCLASS LIKE '&amp;quot;$feat&amp;quot;'&amp;quot; $dest_dir/osm_$feat/osm_$feat.shp $src_shp&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
Now you can use it on each of your shapefiles in the project directory, like this:&lt;br /&gt;
&lt;br /&gt;
 bash extract_features_shapefile.sh hk/gis_osm_landuse_a_free_1-hk.shp .&lt;br /&gt;
&lt;br /&gt;
and so on.&lt;br /&gt;
&lt;br /&gt;
This step prepares us to translate each of the specific types of land classes we need to the FlightGear format, as defined by Material definitions, while also deciding which ones to prune – bear in mind that many of these we can (and should) exclude because leaving them in the final recipe would add too much complexity.&lt;br /&gt;
&lt;br /&gt;
== Map and decode your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Once you reach this stage, you may now have a shit-ton of directories – that was certainly the case for me, as the screenshot illustrates.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles split.png|thumb|center|Oh my, that seems like a lot]]&lt;br /&gt;
&lt;br /&gt;
Not to fear – the light at the end of this tunnel is in sight already. Now we have to do something called [[OSM to materials mapping|mapping]], which is basically the translation I mentioned earlier, and then run ALL these inputs through the TG tool called ogr-decode.&lt;br /&gt;
&lt;br /&gt;
This step can be time-consuming: deciding what to exclude [from the decoding step], and how to map the landclasses you do include.&lt;br /&gt;
You don’t need expertise in QGIS by any means – however, it can certainly come in handy with helping you view all your split shapefiles by importing them in and then tinkering with the layer visibilities to decide on what you don’t need/would add too much complexity versus what is necessary, because remember, performance in FG is of the essence as well (always keep that in mind during this step).&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 1.png|thumb|right|Obviously we'd never need all this, that's why we had further split up these shapefiles]]&lt;br /&gt;
&lt;br /&gt;
'''BRO TIP''': I didn’t realise this myself at first as a n00b to the toolkit, but I was advised by legoboyvdlp that osm_unclassified actually includes numerous roads and isn’t as irrelevant as the name would suggest, in fact it’s better to include this and PRUNE osm_residential for improved performance.&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 2.png|thumb|left|Here you can see a big difference, not to mention I also ended up pruning the selected osm_residential landclass]]&lt;br /&gt;
&lt;br /&gt;
When you map, try to use more standard landclass names as much as possible since those cover mostly everything – unless you have something specific in mind (such as for a custom scenery with its own set of material definitions), try to avoid using any landclasses that aren’t even mentioned in the [https://sourceforge.net/p/flightgear/terragear/ci/next/tree/src/BuildTiles/Main/default_priorities.txt default priorities file].&lt;br /&gt;
That said, if you insist on using other landclasses for whatever reason, you can always create your custom priorities file and add your own landclasses to it, and then just tell tg-construct to use that instead.&lt;br /&gt;
We’ll likely be doing this in bulk, so it makes a ton of sense to create a script for this (shoutout to D-ECHO who I would say has championed this approach) and place it in the TOP level of the TG working directory (so it’s level with ''/data'', ''/work'', ''/output'').&lt;br /&gt;
&lt;br /&gt;
Then, all the arguments will essentially follow this sort of format exactly:&lt;br /&gt;
&lt;br /&gt;
 ogr-decode --max-segment 500 --area-type Default work/Default data/shapefiles/landmass/&lt;br /&gt;
 ogr-decode --max-segment 500 --line-width 12 --area-type Asphalt work/Asphalt data/shapefiles/osm_motorway/&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the other landclasses, hoping you’ve mapped it all correctly.&lt;br /&gt;
So once that’s set, you simply run the script:&lt;br /&gt;
&lt;br /&gt;
 ./decode_osm_data.sh&lt;br /&gt;
&lt;br /&gt;
(note: if you're doing it like this make sure it’s executable first, a quick &amp;lt;code&amp;gt;chmod +x&amp;lt;/code&amp;gt; may come in handy – I like to do this here instead of invoking bash because when I was on Ubuntu in a zsh shell it may have been more efficient for it to simply work through the same shell, entirely up to your preference though)&lt;br /&gt;
&lt;br /&gt;
== Generate your terrain ==&lt;br /&gt;
&lt;br /&gt;
At long last! This step requires us to use the final utility in the TG workflow, &amp;lt;code&amp;gt;tg-construct&amp;lt;/code&amp;gt;, and I like to use a modified version of D-ECHO’s script for this as well:&lt;br /&gt;
&lt;br /&gt;
 ./tg-construct.sh&lt;br /&gt;
&lt;br /&gt;
In my case, the one command I was truly running was as follows:&lt;br /&gt;
&lt;br /&gt;
 tg-construct --work-dir=./work --output-dir=./output/Terrain --min-lon=113 --max-lon=115 --min-lat=21 --max-lat=23 --threads=3 --priorities=/usr/local/share/TerraGear/default_priorities.txt AirportArea SRTM-3 AirportObj Default Ocean Hole Road-Motorway Road-Trunk Road-Residential Road-Primary Road-Secondary Road-Tertiary Road-Service Road-Pedestrian Road-Steps Road-Unclassified Airport Pond Lake DryLake Reservoir IntermittentLake IntermittentStream Watercourse Canal Cliffs Glacier PackIce PolarIce Ocean Estuary Urban SubUrban Town Fishing Construction Industrial Port Dump FloodLand Lagoon Bog Marsh SaltMarsh Sand Saline Littoral Dirt Rock Lava OpenMining BuiltUpCover Transport Cemetery DryCrop IrrCrop Rice MixedCrop Vineyard Bamboo Mangrove ComplexCrop NaturalCrop CropGrass CropWood AgroForest Olives GolfCourse Greenspace GrassCover Grassland ScrubCover Scrub ShrubGrassCover SavannaCover Orchard DeciduousForest DeciduousBroadCover EvergreenForest EvergreenBroadCover MixedForest RainForest BarrenCover HerbTundra Sclerophyllous Heath Burnt SnowCover Island Default Void Null Unknown River Freeway Road Asphalt Railroad Stream&lt;br /&gt;
&lt;br /&gt;
When I changed computers, the only thing I had to alter here was the thread count and the path to the default priorities file.&lt;br /&gt;
&lt;br /&gt;
Now just sit back n relax and enjoy everything, you feel me, because you know what’s about to happen.&lt;br /&gt;
&lt;br /&gt;
[[File:TG success.png|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
And have patience, because this could take a while! '''Seriously!!'''&lt;br /&gt;
For legoboyvdlp, Ireland took a whole week (nonstop!!) to generate! And even for a relatively small scale such as Hong Kong and some of the surrounding area, because the Pearl River Delta is rather dense and data-rich, it took me 24 hours on my 2017 Macbook Pro just for it to reach stage 2 (the second stage out of three, the last of which generates the BTG files), at which point it inexplicably killed the process! So I was left with no choice but to bring out the heavy artillery, and on my beefier rig (8 core CPU, running at 14 threads) at last I was able to complete the whole process in just about three hours (wow!) with Ubuntu in WSL, compiled from source using the download_and_compile script, followed by adding ''install/terragear/bin'' to my user &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt; (in .zshrc, for me) – this way, all the terragear tools can be called normally.&lt;br /&gt;
&lt;br /&gt;
So you see, the quickness of this step will depend entirely on a) the processing power at your disposal and b) the size and richness of the scenery you aim to generate. It may fail along the way for reasons you don’t understand – that’s OK, as long as you know you followed the process correctly just try again and most likely, it should work after some time.&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133508</id>
		<title>Howto:Use TerraGear without wanting to kill yourself</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133508"/>
		<updated>2021-10-14T16:23:12Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: /* Generate your terrain */ reworded&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My aim was to go through this whole process successfully with as little manual labour (don’t have the knowledge to go fine tuning in QGIS? no problem! neither did I) as possible. &amp;quot;Automation ftw&amp;quot; has been my perspective entering this endeavour.&lt;br /&gt;
&lt;br /&gt;
Special thanks to some brilliant lads who walked these roads long before I did, for helping me discover the way! Shoutout [[User:Fahim Dalvi|Fahim]], [[User:D-ECHO|D-ECHO]], and [[User:Legoboyvdlp|legoboyvdlp]], among several others (you know who you are) – in fact, big up the whole FG community.&lt;br /&gt;
&lt;br /&gt;
Hopefully, some of you will find this guide helpful – though at the time of writing, it appears that TerraGear is on the verge of becoming obsolete any minute now. So, if nothing else, it can serve as a time capsule of sorts – a way of recollecting how this task used to be done. Cheers! –– [[User:IskenderWang|IskenderWang]] ([[User talk:IskenderWang|talk]])&lt;br /&gt;
&lt;br /&gt;
== Directory structure ==&lt;br /&gt;
&lt;br /&gt;
Inside your working directory for TerraGear you will simply need three subdirectories – one for your starting '''data''' which you will process as necessary, one for the '''work''' that the TG tools will achieve which provides it with the actual recipe for constructing your scenery, and one for the '''output''' or end product after running tg-construct (the final step) to generate your terrain. My directory structure in the midst of generating several sceneries was looking as pictured.&lt;br /&gt;
&lt;br /&gt;
[[File:TG directory structure.png|thumb|right|A directory format one could expect to utilize while working with TG]]&lt;br /&gt;
&lt;br /&gt;
As you can see, what I like to do is compartmentalise the various sceneries I’ve created/aim to create in their own subdirectories in ''/data'' so to prevent any confusion and easily keep them separate them as I use the TG tools. Since you’re generating terrain one at a time though, I’d strongly recommend clearing out your ''/work'' directory completely in between each.&lt;br /&gt;
&lt;br /&gt;
== Gather all the necessary starting data ==&lt;br /&gt;
&lt;br /&gt;
The materials you will need to embark on your TG journey are:&lt;br /&gt;
# '''Elevation data''': Numerous sources for that but the best option will probably still be [http://viewfinderpanoramas.org/dem3.html viewfinderpanorama].&lt;br /&gt;
# '''All the airports in the area you aim to build''': Best to use some tool like [[TerraMaster]] for this, but keep in mind that Docker TG (even running terragear:latest) seems to only support up to XP apt.dat version 1100 – it unfortunately won’t work with 1130 which is the version most of the latest and greatest airports on [https://gateway.x-plane.com the gateway] will come with, whereas if you compiled the latest TG you should be all good in this respect.&lt;br /&gt;
# '''[https://osmdata.openstreetmap.de/download/land-polygons-complete-4326.zip World landmass polygon]''': This is great since it serves as your base layer and also has very accurate coastlines.&lt;br /&gt;
# '''Shapefiles''': This is where things get interesting, there are numerous sources one can defer to. In the past, people mainly relied on vmap0 and there was a nice mapserver that made it easy to acquire. Nowadays, the mapserver’s gone by the looks of it. Today, while you can still choose [https://gis-lab.info/qa/vmap0-eng.html vmap0], far better options exist for most areas nowadays thanks to the availability of [https://download.geofabrik.de OSM shapefiles] (solid option almost anywhere these days) as well as [[Coordination of Information on the Environment|CORINE]] (Europe), [[Howto:Using QGIS to process NLCD data|NLCD]] (U.S.), and [[User:D-ECHO/Canada Land Cover|LCC]] (Canada), though these others can be a bit less straightforward to obtain and work with – thankfully, if you’d like to try them out there’s documentation for all of those supplied by some top blokes in the FG community.&lt;br /&gt;
&lt;br /&gt;
== Process your elevation data ==&lt;br /&gt;
&lt;br /&gt;
When you unpack your elevation data, make sure to somehow place ALL the hgt files you intend to use in the relevant folder for the scenery in question, with no subdirectories dividing them – using &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; and the wildcard to move all the contents of the needed folders from VFP to where they belonged worked just fine for me; quick and efficient.&lt;br /&gt;
&lt;br /&gt;
For only this step, you could use this command: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:ws20 /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is guaranteed to not have buggy elevation tools, so it’s really your call – you could do it just in case, especially if you’re working exclusively with Docker.&lt;br /&gt;
&lt;br /&gt;
 for f in ${PWD}/data/SRTM-3/scenery-in-question/*.hgt; do hgtchop 3 &amp;quot;${f}&amp;quot; &amp;quot;${PWD}/work/SRTM-3&amp;quot;; done&lt;br /&gt;
 terrafit work/SRTM-3&lt;br /&gt;
&lt;br /&gt;
Now for everything else: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:latest /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Process your airports ==&lt;br /&gt;
&lt;br /&gt;
Once you’ve collected all your airports from the gateway and you’re confident that they’ll work with genapts (perhaps through trial and error) you can just place all the zips in a burner directory and create an airports directory inside of that – then if you have zsh you can simply run my script here in the command line:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/zsh&lt;br /&gt;
 for file in *.zip&lt;br /&gt;
   do&lt;br /&gt;
     FILENAME=$( echo $file | sed s/.zip// )&lt;br /&gt;
     ICAO=$( echo $file | sed s/_Scenery_Pack.zip// )&lt;br /&gt;
     unzip $file&lt;br /&gt;
     cd $FILENAME/&amp;quot;Earth nav data&amp;quot;&lt;br /&gt;
     mv apt.dat ../../airports/$ICAO.dat&lt;br /&gt;
     cd ../..&lt;br /&gt;
     trash $FILENAME&lt;br /&gt;
   done&lt;br /&gt;
 trash ./*zip&lt;br /&gt;
&lt;br /&gt;
and there you have it – all your .dat’s are there and sorted correctly by ICAO, which you can then transfer to your TG ''/data/airports'' folder.&lt;br /&gt;
&lt;br /&gt;
Another way which is even better in a perfect world is to cut out the middleman by using the [https://github.com/mherweg/d-laser-fgtools dlaser tools], however this will always fetch the latest ones, which may not work for you if you’re using Docker TG.&lt;br /&gt;
&lt;br /&gt;
Either way, this step may or may not be cumbersome depending on the amount of ''.dat'' files you’ll need, which can often include not just airports and airfields but also other things such as helipads – for instance, my Hong Kong scenery needed only 5 in total, while 12 tiles of scenery for Florida required 177 (!!) rasclart .dat files, which meant that using the ''gateway_pull.py'' script was a must (you'll need to run it through Python 2 though).&lt;br /&gt;
&lt;br /&gt;
Then, once you’re ready, simply run this command:&lt;br /&gt;
&lt;br /&gt;
 for i in ./data/airports/scenery-in-question/*.dat; do genapts850 --threads --input=$i --work=./work --dem-path=SRTM-3; done&lt;br /&gt;
&lt;br /&gt;
== Determine your bounding box coordinates ==&lt;br /&gt;
&lt;br /&gt;
You may have already done this step in the very beginning, but if not, now would be a good time.&lt;br /&gt;
'''Think of the corners as bottom left, upper right, longitude BEFORE latitude.'''&lt;br /&gt;
&lt;br /&gt;
In my case, for the Hong Kong scenery, the relevant coordinates were &amp;lt;code&amp;gt;113 21&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;115 23&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Crop your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Before we dive more deeply into shapefiles, an important thing to mention is that while the .shp files will be the “stars of the show” in a sense, many of the other files it will come with are also NECESSARY! This means you should not try to delete files that may have seemed redundant to the uninitiated (i.e. me, at that point), and that if you’re going to move shapefiles between directories you’ll have to copy/move ALL of the ones that you will need which come in a set (by having the same filename, just different extensions). After all, most of those other files are there for a good reason, and not just to provide alternative options for GIS users as I had initially assumed. This had me stumped for a little while, wondering why this next tool wasn’t working and almost concerned that I wouldn’t be able to advance beyond this step, UNTIL I came across [https://gis.stackexchange.com/questions/262505/python-cant-read-shapefile/262509 this post on Stack Exchange] and it all made sense, so big up Michael Stimson as well for the helpful answer.&lt;br /&gt;
&lt;br /&gt;
Something to note so that you don’t have to make that same mistake :) First, make sure you're inside ''/data/shapefiles'' (run a quick &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; if not). Then, we simply run:&lt;br /&gt;
&lt;br /&gt;
 ogr2ogr -clipsrc 113 21 115 23 hk.shp land_polygons.shp&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the others as well – you can even use colons to run them all in one go, as I did. Be patient, though, because if your initial region &amp;amp; shapefiles are large then it can take longer than you may have expected at first.&lt;br /&gt;
&lt;br /&gt;
== Split your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
At this point, you can put your cropped project shapefiles in their own directory and then delete or keep the full shapefiles depending on if you intend to use them again or not – that said, you should probably keep the land polygons (default) shapefile for future use since it can act as the base for the whole world, but for your cropped landmass shapefile for THIS scenery you can make a separate directory. I called mine simply “landmass” and now it may look something like what you see in the screenshot.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles folder.png|thumb|center|The directory for shapefiles and how it could look at the extraction/splitting step]]&lt;br /&gt;
&lt;br /&gt;
Here is Fahim's wonderful script, which allows us to perform this step:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # Check arguments&lt;br /&gt;
 if [ $# -lt 2 ]; then&lt;br /&gt;
     echo &amp;quot;Usage: bash extract_features_shapefile.sh &amp;lt;path-to-shapefile&amp;gt; &amp;lt;path-to-output-dir&amp;gt;&amp;quot;&lt;br /&gt;
     exit&lt;br /&gt;
 fi&lt;br /&gt;
 src_shp=$1&lt;br /&gt;
 dest_dir=$2&lt;br /&gt;
 # Extract available feature list in supplied shapefile&lt;br /&gt;
 echo &amp;quot;Extracting available features...&amp;quot;&lt;br /&gt;
 feature_list=$(ogrinfo -al $src_shp | grep 'fclass (String)' | tr -s ' ' | cut -d' ' -f5 | sort | uniq)&lt;br /&gt;
 echo &amp;quot;Found following features:&amp;quot;&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo $feat&lt;br /&gt;
 done&lt;br /&gt;
 # Create shapefile per feature from supplied shapefile&lt;br /&gt;
 echo &amp;quot;Creating new shapefiles...&amp;quot;&lt;br /&gt;
 mkdir -p $dest_dir&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo &amp;quot;Processing $feat...&amp;quot;&lt;br /&gt;
     mkdir -p $dest_dir/osm_$feat&lt;br /&gt;
     ogr2ogr -where &amp;quot;FCLASS LIKE '&amp;quot;$feat&amp;quot;'&amp;quot; $dest_dir/osm_$feat/osm_$feat.shp $src_shp&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
Now you can use it on each of your shapefiles in the project directory, like this:&lt;br /&gt;
&lt;br /&gt;
 bash extract_features_shapefile.sh hk/gis_osm_landuse_a_free_1-hk.shp .&lt;br /&gt;
&lt;br /&gt;
and so on.&lt;br /&gt;
&lt;br /&gt;
This step prepares us to translate each of the specific types of land classes we need to the FlightGear format, as defined by Material definitions, while also deciding which ones to prune – bear in mind that many of these we can (and should) exclude because leaving them in the final recipe would add too much complexity.&lt;br /&gt;
&lt;br /&gt;
== Map and decode your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Once you reach this stage, you may now have a shit-ton of directories – that was certainly the case for me, as the screenshot illustrates.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles split.png|thumb|center|Oh my, that seems like a lot]]&lt;br /&gt;
&lt;br /&gt;
Not to fear – the light at the end of this tunnel is in sight already. Now we have to do something called [[OSM to materials mapping|mapping]], which is basically the translation I mentioned earlier, and then run ALL these inputs through the TG tool called ogr-decode.&lt;br /&gt;
&lt;br /&gt;
This step can be time-consuming: deciding what to exclude [from the decoding step], and how to map the landclasses you do include.&lt;br /&gt;
You don’t need expertise in QGIS by any means – however, it can certainly come in handy with helping you view all your split shapefiles by importing them in and then tinkering with the layer visibilities to decide on what you don’t need/would add too much complexity versus what is necessary, because remember, performance in FG is of the essence as well (always keep that in mind during this step).&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 1.png|thumb|right|Obviously we'd never need all this, that's why we had further split up these shapefiles]]&lt;br /&gt;
&lt;br /&gt;
'''BRO TIP''': I didn’t realise this myself at first as a n00b to the toolkit, but I was advised by legoboyvdlp that osm_unclassified actually includes numerous roads and isn’t as irrelevant as the name would suggest, in fact it’s better to include this and PRUNE osm_residential for improved performance.&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 2.png|thumb|left|Here you can see a big difference, not to mention I also ended up pruning the selected osm_residential landclass]]&lt;br /&gt;
&lt;br /&gt;
When you map, try to use more standard landclass names as much as possible since those cover mostly everything – unless you have something specific in mind (such as for a custom scenery with its own set of material definitions), try to avoid using any landclasses that aren’t even mentioned in the [https://sourceforge.net/p/flightgear/terragear/ci/next/tree/src/BuildTiles/Main/default_priorities.txt default priorities file].&lt;br /&gt;
That said, if you insist on using other landclasses for whatever reason, you can always create your custom priorities file and add your own landclasses to it, and then just tell tg-construct to use that instead.&lt;br /&gt;
We’ll likely be doing this in bulk, so it makes a ton of sense to create a script for this (shoutout to D-ECHO who I would say has championed this approach) and place it in the TOP level of the TG working directory (so it’s level with ''/data'', ''/work'', ''/output'').&lt;br /&gt;
&lt;br /&gt;
Then, all the arguments will essentially follow this sort of format exactly:&lt;br /&gt;
&lt;br /&gt;
 ogr-decode --max-segment 500 --area-type Default work/Default data/shapefiles/landmass/&lt;br /&gt;
 ogr-decode --max-segment 500 --line-width 12 --area-type Asphalt work/Asphalt data/shapefiles/osm_motorway/&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the other landclasses, hoping you’ve mapped it all correctly.&lt;br /&gt;
So once that’s set, you simply run the script:&lt;br /&gt;
&lt;br /&gt;
 ./decode_osm_data.sh&lt;br /&gt;
&lt;br /&gt;
(note: if you're doing it like this make sure it’s executable first, a quick &amp;lt;code&amp;gt;chmod +x&amp;lt;/code&amp;gt; may come in handy – I like to do this here instead of invoking bash because when I was on Ubuntu in a zsh shell it may have been more efficient for it to simply work through the same shell, entirely up to your preference though)&lt;br /&gt;
&lt;br /&gt;
== Generate your terrain ==&lt;br /&gt;
&lt;br /&gt;
At long last! This step requires us to use the final utility in the TG workflow, &amp;lt;code&amp;gt;tg-construct&amp;lt;/code&amp;gt;, and I like to use a modified version of D-ECHO’s script for this as well:&lt;br /&gt;
&lt;br /&gt;
 ./tg-construct.sh&lt;br /&gt;
&lt;br /&gt;
In my case, the one command I was truly running was as follows:&lt;br /&gt;
&lt;br /&gt;
 tg-construct --work-dir=./work --output-dir=./output/Terrain --min-lon=113 --max-lon=115 --min-lat=21 --max-lat=23 --threads=3 --priorities=/usr/local/share/TerraGear/default_priorities.txt AirportArea SRTM-3 AirportObj Default Ocean Hole Road-Motorway Road-Trunk Road-Residential Road-Primary Road-Secondary Road-Tertiary Road-Service Road-Pedestrian Road-Steps Road-Unclassified Airport Pond Lake DryLake Reservoir IntermittentLake IntermittentStream Watercourse Canal Cliffs Glacier PackIce PolarIce Ocean Estuary Urban SubUrban Town Fishing Construction Industrial Port Dump FloodLand Lagoon Bog Marsh SaltMarsh Sand Saline Littoral Dirt Rock Lava OpenMining BuiltUpCover Transport Cemetery DryCrop IrrCrop Rice MixedCrop Vineyard Bamboo Mangrove ComplexCrop NaturalCrop CropGrass CropWood AgroForest Olives GolfCourse Greenspace GrassCover Grassland ScrubCover Scrub ShrubGrassCover SavannaCover Orchard DeciduousForest DeciduousBroadCover EvergreenForest EvergreenBroadCover MixedForest RainForest BarrenCover HerbTundra Sclerophyllous Heath Burnt SnowCover Island Default Void Null Unknown River Freeway Road Asphalt Railroad Stream&lt;br /&gt;
&lt;br /&gt;
When I changed computers, the only thing I had to alter here was the thread count and the path to the default priorities file.&lt;br /&gt;
&lt;br /&gt;
Now just sit back n relax and enjoy everything, you feel me, because you know what’s about to happen.&lt;br /&gt;
&lt;br /&gt;
[[File:TG success.png|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
And have patience, because this could take a while! '''Seriously!!'''&lt;br /&gt;
For legoboyvdlp, Ireland took a whole week (nonstop!!) to generate! And even for a relatively small scale such as Hong Kong and some of the surrounding area, because the Pearl River Delta is rather dense and data-rich, it took me 24 hours on my 2017 Macbook Pro just for it to reach stage 2 (the second stage out of three, the last of which generates the BTG files), at which point it inexplicably killed the process! So I was left with no choice but to bring out the heavy artillery, and on my beefier rig (8 core CPU, running at 14 threads) at last I was able to complete the whole process in just about three hours (wow!) with Ubuntu in WSL, compiled from source using the download_and_compile script, followed by adding ''install/terragear/bin'' to my user &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt; (in .zshrc, for me) – this way, all the terragear tools can be called normally.&lt;br /&gt;
&lt;br /&gt;
So you see, the quickness of this step will depend entirely on a) the processing power at your disposal and b) the size and richness of the scenery you aim to generate. It may fail along the way for reasons you don’t understand – that’s OK, as long as you know you followed the process correctly just try again and most likely, it should work after some time.&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133507</id>
		<title>Howto:Use TerraGear without wanting to kill yourself</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133507"/>
		<updated>2021-10-14T16:17:57Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: some clarification+ce&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My aim was to go through this whole process successfully with as little manual labour (don’t have the knowledge to go fine tuning in QGIS? no problem! neither did I) as possible. &amp;quot;Automation ftw&amp;quot; has been my perspective entering this endeavour.&lt;br /&gt;
&lt;br /&gt;
Special thanks to some brilliant lads who walked these roads long before I did, for helping me discover the way! Shoutout [[User:Fahim Dalvi|Fahim]], [[User:D-ECHO|D-ECHO]], and [[User:Legoboyvdlp|legoboyvdlp]], among several others (you know who you are) – in fact, big up the whole FG community.&lt;br /&gt;
&lt;br /&gt;
Hopefully, some of you will find this guide helpful – though at the time of writing, it appears that TerraGear is on the verge of becoming obsolete any minute now. So, if nothing else, it can serve as a time capsule of sorts – a way of recollecting how this task used to be done. Cheers! –– [[User:IskenderWang|IskenderWang]] ([[User talk:IskenderWang|talk]])&lt;br /&gt;
&lt;br /&gt;
== Directory structure ==&lt;br /&gt;
&lt;br /&gt;
Inside your working directory for TerraGear you will simply need three subdirectories – one for your starting '''data''' which you will process as necessary, one for the '''work''' that the TG tools will achieve which provides it with the actual recipe for constructing your scenery, and one for the '''output''' or end product after running tg-construct (the final step) to generate your terrain. My directory structure in the midst of generating several sceneries was looking as pictured.&lt;br /&gt;
&lt;br /&gt;
[[File:TG directory structure.png|thumb|right|A directory format one could expect to utilize while working with TG]]&lt;br /&gt;
&lt;br /&gt;
As you can see, what I like to do is compartmentalise the various sceneries I’ve created/aim to create in their own subdirectories in ''/data'' so to prevent any confusion and easily keep them separate them as I use the TG tools. Since you’re generating terrain one at a time though, I’d strongly recommend clearing out your ''/work'' directory completely in between each.&lt;br /&gt;
&lt;br /&gt;
== Gather all the necessary starting data ==&lt;br /&gt;
&lt;br /&gt;
The materials you will need to embark on your TG journey are:&lt;br /&gt;
# '''Elevation data''': Numerous sources for that but the best option will probably still be [http://viewfinderpanoramas.org/dem3.html viewfinderpanorama].&lt;br /&gt;
# '''All the airports in the area you aim to build''': Best to use some tool like [[TerraMaster]] for this, but keep in mind that Docker TG (even running terragear:latest) seems to only support up to XP apt.dat version 1100 – it unfortunately won’t work with 1130 which is the version most of the latest and greatest airports on [https://gateway.x-plane.com the gateway] will come with, whereas if you compiled the latest TG you should be all good in this respect.&lt;br /&gt;
# '''[https://osmdata.openstreetmap.de/download/land-polygons-complete-4326.zip World landmass polygon]''': This is great since it serves as your base layer and also has very accurate coastlines.&lt;br /&gt;
# '''Shapefiles''': This is where things get interesting, there are numerous sources one can defer to. In the past, people mainly relied on vmap0 and there was a nice mapserver that made it easy to acquire. Nowadays, the mapserver’s gone by the looks of it. Today, while you can still choose [https://gis-lab.info/qa/vmap0-eng.html vmap0], far better options exist for most areas nowadays thanks to the availability of [https://download.geofabrik.de OSM shapefiles] (solid option almost anywhere these days) as well as [[Coordination of Information on the Environment|CORINE]] (Europe), [[Howto:Using QGIS to process NLCD data|NLCD]] (U.S.), and [[User:D-ECHO/Canada Land Cover|LCC]] (Canada), though these others can be a bit less straightforward to obtain and work with – thankfully, if you’d like to try them out there’s documentation for all of those supplied by some top blokes in the FG community.&lt;br /&gt;
&lt;br /&gt;
== Process your elevation data ==&lt;br /&gt;
&lt;br /&gt;
When you unpack your elevation data, make sure to somehow place ALL the hgt files you intend to use in the relevant folder for the scenery in question, with no subdirectories dividing them – using &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; and the wildcard to move all the contents of the needed folders from VFP to where they belonged worked just fine for me; quick and efficient.&lt;br /&gt;
&lt;br /&gt;
For only this step, you could use this command: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:ws20 /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is guaranteed to not have buggy elevation tools, so it’s really your call – you could do it just in case, especially if you’re working exclusively with Docker.&lt;br /&gt;
&lt;br /&gt;
 for f in ${PWD}/data/SRTM-3/scenery-in-question/*.hgt; do hgtchop 3 &amp;quot;${f}&amp;quot; &amp;quot;${PWD}/work/SRTM-3&amp;quot;; done&lt;br /&gt;
 terrafit work/SRTM-3&lt;br /&gt;
&lt;br /&gt;
Now for everything else: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:latest /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Process your airports ==&lt;br /&gt;
&lt;br /&gt;
Once you’ve collected all your airports from the gateway and you’re confident that they’ll work with genapts (perhaps through trial and error) you can just place all the zips in a burner directory and create an airports directory inside of that – then if you have zsh you can simply run my script here in the command line:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/zsh&lt;br /&gt;
 for file in *.zip&lt;br /&gt;
   do&lt;br /&gt;
     FILENAME=$( echo $file | sed s/.zip// )&lt;br /&gt;
     ICAO=$( echo $file | sed s/_Scenery_Pack.zip// )&lt;br /&gt;
     unzip $file&lt;br /&gt;
     cd $FILENAME/&amp;quot;Earth nav data&amp;quot;&lt;br /&gt;
     mv apt.dat ../../airports/$ICAO.dat&lt;br /&gt;
     cd ../..&lt;br /&gt;
     trash $FILENAME&lt;br /&gt;
   done&lt;br /&gt;
 trash ./*zip&lt;br /&gt;
&lt;br /&gt;
and there you have it – all your .dat’s are there and sorted correctly by ICAO, which you can then transfer to your TG ''/data/airports'' folder.&lt;br /&gt;
&lt;br /&gt;
Another way which is even better in a perfect world is to cut out the middleman by using the [https://github.com/mherweg/d-laser-fgtools dlaser tools], however this will always fetch the latest ones, which may not work for you if you’re using Docker TG.&lt;br /&gt;
&lt;br /&gt;
Either way, this step may or may not be cumbersome depending on the amount of ''.dat'' files you’ll need, which can often include not just airports and airfields but also other things such as helipads – for instance, my Hong Kong scenery needed only 5 in total, while 12 tiles of scenery for Florida required 177 (!!) rasclart .dat files, which meant that using the ''gateway_pull.py'' script was a must (you'll need to run it through Python 2 though).&lt;br /&gt;
&lt;br /&gt;
Then, once you’re ready, simply run this command:&lt;br /&gt;
&lt;br /&gt;
 for i in ./data/airports/scenery-in-question/*.dat; do genapts850 --threads --input=$i --work=./work --dem-path=SRTM-3; done&lt;br /&gt;
&lt;br /&gt;
== Determine your bounding box coordinates ==&lt;br /&gt;
&lt;br /&gt;
You may have already done this step in the very beginning, but if not, now would be a good time.&lt;br /&gt;
'''Think of the corners as bottom left, upper right, longitude BEFORE latitude.'''&lt;br /&gt;
&lt;br /&gt;
In my case, for the Hong Kong scenery, the relevant coordinates were &amp;lt;code&amp;gt;113 21&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;115 23&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Crop your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Before we dive more deeply into shapefiles, an important thing to mention is that while the .shp files will be the “stars of the show” in a sense, many of the other files it will come with are also NECESSARY! This means you should not try to delete files that may have seemed redundant to the uninitiated (i.e. me, at that point), and that if you’re going to move shapefiles between directories you’ll have to copy/move ALL of the ones that you will need which come in a set (by having the same filename, just different extensions). After all, most of those other files are there for a good reason, and not just to provide alternative options for GIS users as I had initially assumed. This had me stumped for a little while, wondering why this next tool wasn’t working and almost concerned that I wouldn’t be able to advance beyond this step, UNTIL I came across [https://gis.stackexchange.com/questions/262505/python-cant-read-shapefile/262509 this post on Stack Exchange] and it all made sense, so big up Michael Stimson as well for the helpful answer.&lt;br /&gt;
&lt;br /&gt;
Something to note so that you don’t have to make that same mistake :) First, make sure you're inside ''/data/shapefiles'' (run a quick &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; if not). Then, we simply run:&lt;br /&gt;
&lt;br /&gt;
 ogr2ogr -clipsrc 113 21 115 23 hk.shp land_polygons.shp&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the others as well – you can even use colons to run them all in one go, as I did. Be patient, though, because if your initial region &amp;amp; shapefiles are large then it can take longer than you may have expected at first.&lt;br /&gt;
&lt;br /&gt;
== Split your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
At this point, you can put your cropped project shapefiles in their own directory and then delete or keep the full shapefiles depending on if you intend to use them again or not – that said, you should probably keep the land polygons (default) shapefile for future use since it can act as the base for the whole world, but for your cropped landmass shapefile for THIS scenery you can make a separate directory. I called mine simply “landmass” and now it may look something like what you see in the screenshot.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles folder.png|thumb|center|The directory for shapefiles and how it could look at the extraction/splitting step]]&lt;br /&gt;
&lt;br /&gt;
Here is Fahim's wonderful script, which allows us to perform this step:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # Check arguments&lt;br /&gt;
 if [ $# -lt 2 ]; then&lt;br /&gt;
     echo &amp;quot;Usage: bash extract_features_shapefile.sh &amp;lt;path-to-shapefile&amp;gt; &amp;lt;path-to-output-dir&amp;gt;&amp;quot;&lt;br /&gt;
     exit&lt;br /&gt;
 fi&lt;br /&gt;
 src_shp=$1&lt;br /&gt;
 dest_dir=$2&lt;br /&gt;
 # Extract available feature list in supplied shapefile&lt;br /&gt;
 echo &amp;quot;Extracting available features...&amp;quot;&lt;br /&gt;
 feature_list=$(ogrinfo -al $src_shp | grep 'fclass (String)' | tr -s ' ' | cut -d' ' -f5 | sort | uniq)&lt;br /&gt;
 echo &amp;quot;Found following features:&amp;quot;&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo $feat&lt;br /&gt;
 done&lt;br /&gt;
 # Create shapefile per feature from supplied shapefile&lt;br /&gt;
 echo &amp;quot;Creating new shapefiles...&amp;quot;&lt;br /&gt;
 mkdir -p $dest_dir&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo &amp;quot;Processing $feat...&amp;quot;&lt;br /&gt;
     mkdir -p $dest_dir/osm_$feat&lt;br /&gt;
     ogr2ogr -where &amp;quot;FCLASS LIKE '&amp;quot;$feat&amp;quot;'&amp;quot; $dest_dir/osm_$feat/osm_$feat.shp $src_shp&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
Now you can use it on each of your shapefiles in the project directory, like this:&lt;br /&gt;
&lt;br /&gt;
 bash extract_features_shapefile.sh hk/gis_osm_landuse_a_free_1-hk.shp .&lt;br /&gt;
&lt;br /&gt;
and so on.&lt;br /&gt;
&lt;br /&gt;
This step prepares us to translate each of the specific types of land classes we need to the FlightGear format, as defined by Material definitions, while also deciding which ones to prune – bear in mind that many of these we can (and should) exclude because leaving them in the final recipe would add too much complexity.&lt;br /&gt;
&lt;br /&gt;
== Map and decode your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Once you reach this stage, you may now have a shit-ton of directories – that was certainly the case for me, as the screenshot illustrates.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles split.png|thumb|center|Oh my, that seems like a lot]]&lt;br /&gt;
&lt;br /&gt;
Not to fear – the light at the end of this tunnel is in sight already. Now we have to do something called [[OSM to materials mapping|mapping]], which is basically the translation I mentioned earlier, and then run ALL these inputs through the TG tool called ogr-decode.&lt;br /&gt;
&lt;br /&gt;
This step can be time-consuming: deciding what to exclude [from the decoding step], and how to map the landclasses you do include.&lt;br /&gt;
You don’t need expertise in QGIS by any means – however, it can certainly come in handy with helping you view all your split shapefiles by importing them in and then tinkering with the layer visibilities to decide on what you don’t need/would add too much complexity versus what is necessary, because remember, performance in FG is of the essence as well (always keep that in mind during this step).&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 1.png|thumb|right|Obviously we'd never need all this, that's why we had further split up these shapefiles]]&lt;br /&gt;
&lt;br /&gt;
'''BRO TIP''': I didn’t realise this myself at first as a n00b to the toolkit, but I was advised by legoboyvdlp that osm_unclassified actually includes numerous roads and isn’t as irrelevant as the name would suggest, in fact it’s better to include this and PRUNE osm_residential for improved performance.&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 2.png|thumb|left|Here you can see a big difference, not to mention I also ended up pruning the selected osm_residential landclass]]&lt;br /&gt;
&lt;br /&gt;
When you map, try to use more standard landclass names as much as possible since those cover mostly everything – unless you have something specific in mind (such as for a custom scenery with its own set of material definitions), try to avoid using any landclasses that aren’t even mentioned in the [https://sourceforge.net/p/flightgear/terragear/ci/next/tree/src/BuildTiles/Main/default_priorities.txt default priorities file].&lt;br /&gt;
That said, if you insist on using other landclasses for whatever reason, you can always create your custom priorities file and add your own landclasses to it, and then just tell tg-construct to use that instead.&lt;br /&gt;
We’ll likely be doing this in bulk, so it makes a ton of sense to create a script for this (shoutout to D-ECHO who I would say has championed this approach) and place it in the TOP level of the TG working directory (so it’s level with ''/data'', ''/work'', ''/output'').&lt;br /&gt;
&lt;br /&gt;
Then, all the arguments will essentially follow this sort of format exactly:&lt;br /&gt;
&lt;br /&gt;
 ogr-decode --max-segment 500 --area-type Default work/Default data/shapefiles/landmass/&lt;br /&gt;
 ogr-decode --max-segment 500 --line-width 12 --area-type Asphalt work/Asphalt data/shapefiles/osm_motorway/&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the other landclasses, hoping you’ve mapped it all correctly.&lt;br /&gt;
So once that’s set, you simply run the script:&lt;br /&gt;
&lt;br /&gt;
 ./decode_osm_data.sh&lt;br /&gt;
&lt;br /&gt;
(note: if you're doing it like this make sure it’s executable first, a quick &amp;lt;code&amp;gt;chmod +x&amp;lt;/code&amp;gt; may come in handy – I like to do this here instead of invoking bash because when I was on Ubuntu in a zsh shell it may have been more efficient for it to simply work through the same shell, entirely up to your preference though)&lt;br /&gt;
&lt;br /&gt;
== Generate your terrain ==&lt;br /&gt;
&lt;br /&gt;
At long last! This step requires us to use the final utility in the TG workflow, &amp;lt;code&amp;gt;tg-construct&amp;lt;/code&amp;gt;, and I like to use a modified version of D-ECHO’s script for this as well:&lt;br /&gt;
&lt;br /&gt;
 ./tg-construct.sh&lt;br /&gt;
&lt;br /&gt;
In my case, the one command I was truly running was as follows:&lt;br /&gt;
&lt;br /&gt;
 tg-construct --work-dir=./work --output-dir=./output/Terrain --min-lon=113 --max-lon=115 --min-lat=21 --max-lat=23 --threads=3 --priorities=/usr/local/share/TerraGear/default_priorities.txt AirportArea SRTM-3 AirportObj Default Ocean Hole Road-Motorway Road-Trunk Road-Residential Road-Primary Road-Secondary Road-Tertiary Road-Service Road-Pedestrian Road-Steps Road-Unclassified Airport Pond Lake DryLake Reservoir IntermittentLake IntermittentStream Watercourse Canal Cliffs Glacier PackIce PolarIce Ocean Estuary Urban SubUrban Town Fishing Construction Industrial Port Dump FloodLand Lagoon Bog Marsh SaltMarsh Sand Saline Littoral Dirt Rock Lava OpenMining BuiltUpCover Transport Cemetery DryCrop IrrCrop Rice MixedCrop Vineyard Bamboo Mangrove ComplexCrop NaturalCrop CropGrass CropWood AgroForest Olives GolfCourse Greenspace GrassCover Grassland ScrubCover Scrub ShrubGrassCover SavannaCover Orchard DeciduousForest DeciduousBroadCover EvergreenForest EvergreenBroadCover MixedForest RainForest BarrenCover HerbTundra Sclerophyllous Heath Burnt SnowCover Island Default Void Null Unknown River Freeway Road Asphalt Railroad Stream&lt;br /&gt;
&lt;br /&gt;
When I changed computers, the only thing I had to alter here was the thread count and the path to the default priorities file.&lt;br /&gt;
&lt;br /&gt;
Now just sit back n relax and enjoy everything, you feel me, because you know what’s about to happen.&lt;br /&gt;
&lt;br /&gt;
[[File:TG success.png|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
And have patience, because this could take a while! '''Seriously!!'''&lt;br /&gt;
For legoboyvdlp, Ireland took a whole week (nonstop!!) to generate! And even for a relatively small scale such as Hong Kong and some of the surrounding area, because the Pearl River Delta is rather dense and data-rich, it took me 24 hours on my 2017 Macbook Pro just for it to reach stage 2 (the second stage out of three, the last of which generates the BTG files), at which point it inexplicably killed the process! So I had to pull out the big guns, and on my heavier rig (8 core CPU, running at 14 threads) at last I was able to complete the whole process in just about three hours (wow!) with Ubuntu in WSL, compiled from source using the download_and_compile script, followed by adding ''install/terragear/bin'' to my user &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt; (in .zshrc, for me) – this way, all the terragear tools can be called normally.&lt;br /&gt;
&lt;br /&gt;
So you see, the quickness of this step will depend entirely on a) the processing power at your disposal and b) the size and richness of the scenery you aim to generate. It may fail along the way for reasons you don’t understand – that’s OK, as long as you know you followed the process correctly just try again and most likely, it should work after some time.&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=User:IskenderWang&amp;diff=133493</id>
		<title>User:IskenderWang</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=User:IskenderWang&amp;diff=133493"/>
		<updated>2021-10-14T07:08:10Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: Created page with &amp;quot;You can find me/show me some love over at my [https://github.com/IskenderWang GitHub page]  Feel free to [https://www.youtube.com/watch?v=JDy-ZLlYEGw holla at ya boy] over on...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;You can find me/show me some love over at my [https://github.com/IskenderWang GitHub page]&lt;br /&gt;
&lt;br /&gt;
Feel free to [https://www.youtube.com/watch?v=JDy-ZLlYEGw holla at ya boy] over on the [[Discord|Discord for FG]] as well ;)&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133492</id>
		<title>Howto:Use TerraGear without wanting to kill yourself</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Use_TerraGear_without_wanting_to_kill_yourself&amp;diff=133492"/>
		<updated>2021-10-14T07:00:51Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: Created page with &amp;quot;My aim was to go through this whole process successfully with as little manual labour (don’t have the knowledge to go fine tuning in QGIS? no problem! neither did I) as poss...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;My aim was to go through this whole process successfully with as little manual labour (don’t have the knowledge to go fine tuning in QGIS? no problem! neither did I) as possible. &amp;quot;Automation ftw&amp;quot; has been my perspective entering this endeavour.&lt;br /&gt;
&lt;br /&gt;
Special thanks to some brilliant lads who walked these roads long before I did, for helping me discover the way! Shoutout [[User:Fahim Dalvi|Fahim]], [[User:D-ECHO|D-ECHO]], and [[User:Legoboyvdlp|legoboyvdlp]], among several others (you know who you are) – in fact, big up the whole FG community.&lt;br /&gt;
&lt;br /&gt;
Hopefully, some of you will find this guide helpful – though at the time of writing, it appears that TerraGear is on the verge of becoming obsolete any minute now. So, if nothing else, it can serve as a time capsule of sorts – a way of recollecting how this task used to be done. Cheers! –– [[User:IskenderWang|IskenderWang]] ([[User talk:IskenderWang|talk]])&lt;br /&gt;
&lt;br /&gt;
== Directory structure ==&lt;br /&gt;
&lt;br /&gt;
Inside your working directory for TerraGear you will simply need three subdirectories – one for your starting '''data''' which you will process as necessary, one for the '''work''' that the TG tools will achieve which provides it with the actual recipe for constructing your scenery, and one for the '''output''' or end product after running tg-construct (the final step) to generate your terrain. My directory structure in the midst of generating several sceneries was looking as pictured.&lt;br /&gt;
&lt;br /&gt;
[[File:TG directory structure.png|thumb|right|A directory format one could expect to utilize while working with TG]]&lt;br /&gt;
&lt;br /&gt;
As you can see, what I like to do is compartmentalise the various sceneries I’ve created/aim to create in their own subdirectories in ''/data'' so to prevent any confusion and easily keep them separate them as I use the TG tools. Since you’re generating terrain one at a time though, I’d strongly recommend clearing out your ''/work'' directory completely in between each.&lt;br /&gt;
&lt;br /&gt;
== Gather all the necessary starting data ==&lt;br /&gt;
&lt;br /&gt;
The materials you will need to embark on your TG journey are:&lt;br /&gt;
# '''Elevation data''': Numerous sources for that but the best option will probably still be [http://viewfinderpanoramas.org/dem3.html viewfinderpanorama].&lt;br /&gt;
# '''All the airports in the area you aim to build''': Best to use some tool like [[TerraMaster]] for this, but keep in mind that Docker TG (even running terragear:latest) seems to only support up to XP apt.dat version 1100 – it unfortunately won’t work with 1130 which is the version most of the latest and greatest airports on [https://gateway.x-plane.com the gateway] will come with, whereas if you compiled the latest TG you should be all good in this respect.&lt;br /&gt;
# '''[https://osmdata.openstreetmap.de/download/land-polygons-complete-4326.zip World landmass polygon]''': This is great since it serves as your base layer and also has very accurate coastlines.&lt;br /&gt;
# '''Shapefiles''': This is where things get interesting, there are numerous sources one can defer to. In the past, people mainly relied on vmap0 and there was a nice mapserver that made it easy to acquire. Nowadays, the mapserver’s gone by the looks of it. Today, while you can still choose [https://gis-lab.info/qa/vmap0-eng.html vmap0], far better options exist for most areas nowadays thanks to the availability of [https://download.geofabrik.de OSM shapefiles] (solid option almost anywhere these days) as well as [[Coordination of Information on the Environment|CORINE]] (Europe), [[Howto:Using QGIS to process NLCD data|NLCD]] (U.S.), and [[User:D-ECHO/Canada Land Cover|LCC]] (Canada), though these others can be a bit less straightforward to obtain and work with – thankfully, if you’d like to try them out there’s documentation for all of those supplied by some top blokes in the FG community.&lt;br /&gt;
&lt;br /&gt;
== Process your elevation data ==&lt;br /&gt;
&lt;br /&gt;
When you unpack your elevation data, make sure to somehow place ALL the hgt files you intend to use in the relevant folder for the scenery in question, with no subdirectories dividing them – using &amp;lt;code&amp;gt;mv&amp;lt;/code&amp;gt; and the wildcard to move all the contents of the needed folders from VFP to where they belonged worked just fine for me; quick and efficient.&lt;br /&gt;
&lt;br /&gt;
For only this step, you could use this command: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:ws20 /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since this is guaranteed to not have buggy elevation tools, so it’s really your call – you could do it just in case, especially if you’re working exclusively with Docker.&lt;br /&gt;
&lt;br /&gt;
 for f in ${PWD}/data/SRTM-3/scenery-in-question/*.hgt; do hgtchop 3 &amp;quot;${f}&amp;quot; &amp;quot;${PWD}/work/SRTM-3&amp;quot;; done&lt;br /&gt;
 terrafit work/SRTM-3&lt;br /&gt;
&lt;br /&gt;
Now for everything else: &amp;lt;code&amp;gt;docker run -i -v ~/terragear-work:/terragear-work/ -t flightgear/terragear:latest /bin/bash&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Process your airports ==&lt;br /&gt;
&lt;br /&gt;
Once you’ve collected all your airports from the gateway and you’re confident that they’ll work with genapts (perhaps through trial and error) you can just place all the zips in a burner directory and create an airports directory inside of that – then if you have zsh you can simply run my script here in the command line:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/zsh&lt;br /&gt;
 for file in *.zip&lt;br /&gt;
   do&lt;br /&gt;
     FILENAME=$( echo $file | sed s/.zip// )&lt;br /&gt;
     ICAO=$( echo $file | sed s/_Scenery_Pack.zip// )&lt;br /&gt;
     unzip $file&lt;br /&gt;
     cd $FILENAME/&amp;quot;Earth nav data&amp;quot;&lt;br /&gt;
     mv apt.dat ../../airports/$ICAO.dat&lt;br /&gt;
     cd ../..&lt;br /&gt;
     trash $FILENAME&lt;br /&gt;
   done&lt;br /&gt;
 trash ./*zip&lt;br /&gt;
&lt;br /&gt;
and there you have it – all your .dat’s are there and sorted correctly by ICAO, which you can then transfer to your TG ''/data/airports'' folder.&lt;br /&gt;
&lt;br /&gt;
Another way which is even better in a perfect world is to cut out the middleman by using the [https://github.com/mherweg/d-laser-fgtools dlaser tools], however this will always fetch the latest ones, which may not work for you if you’re using Docker TG.&lt;br /&gt;
&lt;br /&gt;
Either way, this step may or may not be cumbersome depending on the amount of ''.dat'' files you’ll need, which can often include not just airports and airfields but also other things such as helipads – for instance, my Hong Kong scenery needed only 5 in total, while 12 tiles of scenery for Florida required 177 (!!) rasclart .dat files, which meant that using the ''gateway_pull.py'' script was a must (you'll need to run it through Python 2 though).&lt;br /&gt;
&lt;br /&gt;
Then, once you’re ready, simply run this command:&lt;br /&gt;
&lt;br /&gt;
 for i in ./data/airports/scenery-in-question/*.dat; do genapts850 --threads --input=$i --work=./work --dem-path=SRTM-3; done&lt;br /&gt;
&lt;br /&gt;
== Determine your bounding box coordinates ==&lt;br /&gt;
&lt;br /&gt;
You may have already done this step in the very beginning, but if not, now would be a good time.&lt;br /&gt;
'''Think of the corners as bottom left, upper right, longitude BEFORE latitude.'''&lt;br /&gt;
&lt;br /&gt;
In my case, for the Hong Kong scenery, the relevant coordinates were &amp;lt;code&amp;gt;113 21&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;115 23&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
== Crop your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Before we dive more deeply into shapefiles, an important thing to mention is that while the .shp files will be the “stars of the show” in a sense, many of the other files it will come with are also NECESSARY! This means you should not try to delete files that may have seemed redundant to the uninitiated (i.e. me, at that point), and that if you’re going to move shapefiles between directories you’ll have to copy/move ALL of the ones that you will need which come in a set (by having the same filename, just different extensions). After all, most of those other files are there for a good reason, and not just to provide alternative options for GIS users as I had initially assumed. This had me stumped for a little while, wondering why this next tool wasn’t working and almost concerned that I wouldn’t be able to advance beyond this step, UNTIL I came across [https://gis.stackexchange.com/questions/262505/python-cant-read-shapefile/262509 this post on Stack Exchange] and it all made sense, so big up Michael Stimson as well for the helpful answer.&lt;br /&gt;
&lt;br /&gt;
Something to note so that you don’t have to make that same mistake :) First, make sure you're inside ''/data/shapefiles'' (run a quick &amp;lt;code&amp;gt;cd&amp;lt;/code&amp;gt; if not). Then, we simply run:&lt;br /&gt;
&lt;br /&gt;
 ogr2ogr -clipsrc 113 21 115 23 hk.shp land_polygons.shp&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the others as well – you can even use colons to run them all in one go, as I did. Be patient, though, because if your initial region &amp;amp; shapefiles are large then it can take longer than you may have expected at first.&lt;br /&gt;
&lt;br /&gt;
== Split your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
At this point, you can put your cropped project shapefiles in their own directory and then delete or keep the full shapefiles depending on if you intend to use them again or not – that said, you should probably keep the land polygons (default) shapefile for future use since it can act as the base for the whole world, but for your cropped landmass shapefile for THIS scenery you can make a separate directory. I called mine simply “landmass” and now it may look something like what you see in the screenshot.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles folder.png|thumb|center|The directory for shapefiles and how it could look at the extraction/splitting step]]&lt;br /&gt;
&lt;br /&gt;
Here is Fahim's wonderful script, which allows us to perform this step:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 # Check arguments&lt;br /&gt;
 if [ $# -lt 2 ]; then&lt;br /&gt;
     echo &amp;quot;Usage: bash extract_features_shapefile.sh &amp;lt;path-to-shapefile&amp;gt; &amp;lt;path-to-output-dir&amp;gt;&amp;quot;&lt;br /&gt;
     exit&lt;br /&gt;
 fi&lt;br /&gt;
 src_shp=$1&lt;br /&gt;
 dest_dir=$2&lt;br /&gt;
 # Extract available feature list in supplied shapefile&lt;br /&gt;
 echo &amp;quot;Extracting available features...&amp;quot;&lt;br /&gt;
 feature_list=$(ogrinfo -al $src_shp | grep 'fclass (String)' | tr -s ' ' | cut -d' ' -f5 | sort | uniq)&lt;br /&gt;
 echo &amp;quot;Found following features:&amp;quot;&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo $feat&lt;br /&gt;
 done&lt;br /&gt;
 # Create shapefile per feature from supplied shapefile&lt;br /&gt;
 echo &amp;quot;Creating new shapefiles...&amp;quot;&lt;br /&gt;
 mkdir -p $dest_dir&lt;br /&gt;
 for feat in ${feature_list}; do&lt;br /&gt;
     echo &amp;quot;Processing $feat...&amp;quot;&lt;br /&gt;
     mkdir -p $dest_dir/osm_$feat&lt;br /&gt;
     ogr2ogr -where &amp;quot;FCLASS LIKE '&amp;quot;$feat&amp;quot;'&amp;quot; $dest_dir/osm_$feat/osm_$feat.shp $src_shp&lt;br /&gt;
 done&lt;br /&gt;
&lt;br /&gt;
Now you can use it on each of your shapefiles in the project directory, like this:&lt;br /&gt;
&lt;br /&gt;
 bash extract_features_shapefile.sh hk/gis_osm_landuse_a_free_1-hk.shp .&lt;br /&gt;
&lt;br /&gt;
and so on.&lt;br /&gt;
&lt;br /&gt;
This step prepares us to translate each of the specific types of land classes we need to the FlightGear format, as defined by Material definitions, while also deciding which ones to prune – bear in mind that many of these we can (and should) exclude because leaving them in the final recipe would add too much complexity.&lt;br /&gt;
&lt;br /&gt;
== Map and decode your shapefiles ==&lt;br /&gt;
&lt;br /&gt;
Once you reach this stage, you may now have a shit-ton of directories – that was certainly the case for me, as the screenshot illustrates.&lt;br /&gt;
&lt;br /&gt;
[[File:Shapefiles split.png|thumb|center|Oh my, that seems like a lot]]&lt;br /&gt;
&lt;br /&gt;
Not to fear – the light at the end of this tunnel is in sight already. Now we have to do something called [[OSM to materials mapping|mapping]], which is basically the translation I mentioned earlier, and then run ALL these inputs through the TG tool called ogr-decode.&lt;br /&gt;
&lt;br /&gt;
This step can be time-consuming: deciding what to exclude [from the decoding step], and how to map the landclasses you do include.&lt;br /&gt;
You don’t need expertise in QGIS by any means – however, it can certainly come in handy with helping you view all your split shapefiles by importing them in and then tinkering with the layer visibilities to decide on what you don’t need/would add too much complexity versus what is necessary, because remember, performance in FG is of the essence as well (always keep that in mind during this step).&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 1.png|thumb|right|Obviously we'd never need all this, that's why we had further split up these shapefiles]]&lt;br /&gt;
&lt;br /&gt;
'''BRO TIP''': I didn’t realize this myself at first as a n00b to the toolkit, but I was advised by legoboyvdlp that osm_unclassified actually includes numerous roads and isn’t as irrelevant as the name would suggest, in fact it’s better to include this and PRUNE osm_residential for improved performance.&lt;br /&gt;
&lt;br /&gt;
[[File:QGIS example for TG 2.png|thumb|left|Here you can see a big difference, not to mention I also ended up pruning the selected osm_residential landclass]]&lt;br /&gt;
&lt;br /&gt;
When you map, try to use more standard landclass names as much as possible since those cover mostly everything – unless you have something specific in mind (such as for a custom scenery with its own set of material definitions), try to avoid using any landclasses that aren’t even mentioned in the [https://sourceforge.net/p/flightgear/terragear/ci/next/tree/src/BuildTiles/Main/default_priorities.txt default priorities file].&lt;br /&gt;
That said, if you insist on using other landclasses for whatever reason, you can always create your custom priorities file and add your own landclasses to it, and then just tell tg-construct to use that instead.&lt;br /&gt;
We’ll likely be doing this in bulk, so it makes a ton of sense to create a script for this (shoutout to D-ECHO who I would say has championed this approach) and place it in the TOP level of the TG working directory (so it’s level with ''/data'', ''/work'', ''/output'').&lt;br /&gt;
&lt;br /&gt;
Then, all the arguments will essentially follow this sort of format exactly:&lt;br /&gt;
&lt;br /&gt;
 ogr-decode --max-segment 500 --area-type Default work/Default data/shapefiles/landmass/&lt;br /&gt;
 ogr-decode --max-segment 500 --line-width 12 --area-type Asphalt work/Asphalt data/shapefiles/osm_motorway/&lt;br /&gt;
&lt;br /&gt;
and so on for ALL the other landclasses, hoping you’ve mapped it all correctly.&lt;br /&gt;
So once that’s set, you simply run the script:&lt;br /&gt;
&lt;br /&gt;
 ./decode_osm_data.sh&lt;br /&gt;
&lt;br /&gt;
(note: if you're doing it like this make sure it’s executable first, a quick &amp;lt;code&amp;gt;chmod +x&amp;lt;/code&amp;gt; may come in handy – I like to do this here instead of invoking bash because when I was on Ubuntu in a zsh shell it may have been more efficient for it to simply work through the same shell, entirely up to your preference though)&lt;br /&gt;
&lt;br /&gt;
== Generate your terrain ==&lt;br /&gt;
&lt;br /&gt;
At long last! This step requires us to use the final utility in the TG workflow, &amp;lt;code&amp;gt;tg-construct&amp;lt;/code&amp;gt;, and I like to use a modified version of D-ECHO’s script for this as well:&lt;br /&gt;
&lt;br /&gt;
 ./tg-construct.sh&lt;br /&gt;
&lt;br /&gt;
In my case, the one command I was truly running was as follows:&lt;br /&gt;
&lt;br /&gt;
 tg-construct --work-dir=./work --output-dir=./output/Terrain --min-lon=113 --max-lon=115 --min-lat=21 --max-lat=23 --threads=3 --priorities=/usr/local/share/TerraGear/default_priorities.txt AirportArea SRTM-3 AirportObj Default Ocean Hole Road-Motorway Road-Trunk Road-Residential Road-Primary Road-Secondary Road-Tertiary Road-Service Road-Pedestrian Road-Steps Road-Unclassified Airport Pond Lake DryLake Reservoir IntermittentLake IntermittentStream Watercourse Canal Cliffs Glacier PackIce PolarIce Ocean Estuary Urban SubUrban Town Fishing Construction Industrial Port Dump FloodLand Lagoon Bog Marsh SaltMarsh Sand Saline Littoral Dirt Rock Lava OpenMining BuiltUpCover Transport Cemetery DryCrop IrrCrop Rice MixedCrop Vineyard Bamboo Mangrove ComplexCrop NaturalCrop CropGrass CropWood AgroForest Olives GolfCourse Greenspace GrassCover Grassland ScrubCover Scrub ShrubGrassCover SavannaCover Orchard DeciduousForest DeciduousBroadCover EvergreenForest EvergreenBroadCover MixedForest RainForest BarrenCover HerbTundra Sclerophyllous Heath Burnt SnowCover Island Default Void Null Unknown River Freeway Road Asphalt Railroad Stream&lt;br /&gt;
&lt;br /&gt;
When I changed computers, the only thing I had to alter here was the thread count and the path to the default priorities file.&lt;br /&gt;
&lt;br /&gt;
Now just sit back n relax and enjoy everything, you feel me, because you know what’s about to happen.&lt;br /&gt;
&lt;br /&gt;
[[File:TG success.png|thumb|Success]]&lt;br /&gt;
&lt;br /&gt;
And have patience, because this could take a while! '''Seriously!!'''&lt;br /&gt;
For legoboyvdlp, Ireland took a whole week (nonstop!!) to generate! And even for a relatively small scale such as Hong Kong and some of the surrounding area, because the Pearl River Delta is rather dense and data-rich, it took me 24 hours on my 2017 Macbook Pro just for it to reach stage 2 (the second stage out of three, the last of which generates the BTG files), at which point it inexplicably killed the process! So I had to pull out the big guns, and on my heavier rig (8 core CPU, running at 14 threads) at last I was able to complete the whole process in just about three hours (wow!) with Ubuntu in WSL, compiled from source using the download_and_compile script, followed by adding ''install/terragear/bin'' to my &amp;lt;code&amp;gt;$PATH&amp;lt;/code&amp;gt; – this way, all the terragear tools can be called normally.&lt;br /&gt;
&lt;br /&gt;
So you see, the quickness of this step will depend entirely on a) the processing power at your disposal and b) the size and richness of the scenery you aim to generate. It may fail along the way for reasons you don’t understand – that’s OK, as long as you know you followed the process correctly just try again and most likely, it should work after some time.&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:TG_success.png&amp;diff=133491</id>
		<title>File:TG success.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:TG_success.png&amp;diff=133491"/>
		<updated>2021-10-14T06:36:18Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;tg-construct has finished successfully&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:Shapefiles_folder.png&amp;diff=133490</id>
		<title>File:Shapefiles folder.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:Shapefiles_folder.png&amp;diff=133490"/>
		<updated>2021-10-14T06:13:26Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The directory for shapefiles and how it could look at the extraction/splitting step&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=User_talk:Gijs&amp;diff=133489</id>
		<title>User talk:Gijs</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=User_talk:Gijs&amp;diff=133489"/>
		<updated>2021-10-14T06:09:38Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: /* Oversight/deletion of images */ new section&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Archives|[[/Archive 2008-2011|2008-2011]]|[[/Archive 2012|2012]]}}&lt;br /&gt;
&lt;br /&gt;
==&amp;quot;Talk:Eurocopter EC135&amp;quot; (Author request: Author blanked page)==&lt;br /&gt;
&lt;br /&gt;
Did I miss something? Can't remember seen that...&lt;br /&gt;
Can you tell what it was about?&lt;br /&gt;
Cheers --[[User:HHS|HHS]] 12:24, 17 February 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
: Hi,&lt;br /&gt;
: F-JJTH wrote &amp;quot; Heiko, is V1.0 full &amp;quot;Rembrandt compatible&amp;quot; ?&amp;quot; on the page but blanked it shortly thereafter. I think he found the answer already... So all I did was delete that blank page. &lt;br /&gt;
: [[User:Gijs|Gijs]] 16:08, 17 February 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
==About the wiki..==&lt;br /&gt;
Hi Gijs, hope all is well. I was stopping by because I noticed the words &amp;quot;Please post only encyclopedic information that can be verified by external sources. Please maintain a neutral, unbiased point of view. &amp;quot; in the editor. Its really not right to say this, because the FlightGear wiki has to be a &amp;quot;primary source&amp;quot;. The contributions are typically original writing, and it specifically includes opinions (such as reviews), as well as first-hand accounts. Thank you. [[User:Fg|Fg]] 20:19, 17 July 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The wiki is mostly a primary source, saying &amp;quot;Please post only encyclopedic information that can be verified by external sources. .. &amp;quot; makes no sense. Most of what is written here is orginal content, and it does not make sense to have this in the edit box. Also, I don't agree with many of the articles you have deleted. These are small issues in view of your large contributions to the project, and I want to thank you for those, but I must also bring up these issues. Thanks again.  [[User:Fg|Fg]] ([[User talk:Fg|talk]]) 20:32, 28 October 2013 (UTC)&lt;br /&gt;
: Hi,&lt;br /&gt;
: You're right about the &amp;quot;external sources&amp;quot; statement. That was just a default from MediaWiki but is not very applicable to our wiki. I've removed it now. Thanks for notifying me!&lt;br /&gt;
: What is it that you don't agree with? Is it the airport articles? Those were not deleted yet, they were only marked for deletion. The notice mentioned why I think they should be deleted. Feel free to share your arguments that make you think they should be kept. As the template stated &amp;quot;Do not remove this tag until the discussion is closed.&amp;quot;, so I've placed the templates back and am looking forward to your (argued) opinion.&lt;br /&gt;
: Cheers,&lt;br /&gt;
: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 17:47, 31 October 2013 (UTC)&lt;br /&gt;
::Great, thanks for fixing that! Come to think of it &amp;quot;Please maintain a neutral, unbiased point of view.&amp;quot; may also be unneeded, as we have sections for reviews (with opinions) of aircraft, etc. but I will leave that up to you. I will check out the articles for deletion again. Thank you. [[User:Fg|Fg]] ([[User talk:Fg|talk]]) 22:57, 4 December 2013 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Adding the village pump to the sidebar or not ==&lt;br /&gt;
&lt;br /&gt;
I have been pondering adding the village pump to the sidebar.  I would probably add it between Recent changes and Random page.  I have read in a bit on the sidebar on the MediaWiki help pages, but before I actually do it I want to ask you about your opinion about doing that.&lt;br /&gt;
&lt;br /&gt;
The biggest pros and cons as I see it is that anyone will find it so it will be used a bit more, but at the same time that those that will not even read a few sentences of text (including people not comfortably reading English) sometimes will go there for help on using the simulator itself instead of going to the forum.&lt;br /&gt;
&lt;br /&gt;
So what do you think about it?&lt;br /&gt;
&lt;br /&gt;
—[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 09:00, 5 January 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
: Hi,&lt;br /&gt;
: how about creating a &amp;quot;Wiki&amp;quot; header that contains the &amp;quot;Recent changes&amp;quot; and &amp;quot;Help&amp;quot; links? It could then also have a link to the village pump. I don't think we should call it &amp;quot;Village pump&amp;quot; though, as probably no-one will guess that's a place to talk about the wiki ;-) Something like &amp;quot;Wiki discussions&amp;quot; or so is more descriptive...&lt;br /&gt;
: Cheers, [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 13:52, 5 January 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: I have been thinking of changing the name of that page as well.  &amp;quot;Village pump&amp;quot; is used on WikiMedia Commons, the Swedish Wikipedia (though translated) and probably a few other wikis so someone coming from one of those places would be at home with it, but not everyone are from those places.&lt;br /&gt;
:: I have in the past considered suggesting changing it into say &amp;quot;Editor lounge&amp;quot; or rather something aviation related, but for instance &amp;quot;Pilot lounge&amp;quot; would have been so horribly misleading. ;-)&lt;br /&gt;
:: A &amp;quot;Wiki&amp;quot; header will help organise the contents but might hide contents by default, but hopefully people are curious enough to spend a few seconds looking around.&lt;br /&gt;
:: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 19:19, 5 January 2014 (UTC)&lt;br /&gt;
::: Went ahead and added a link in the sidebar titled &amp;quot;[[FlightGear wiki:Village pump|Discuss!]]&amp;quot;.&lt;br /&gt;
::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 13:58, 2 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Help with Fatal error: Class 'Services_JSON'  /CategoryTree/CategoryTreeFunctions.php on line 224 Error ==&lt;br /&gt;
&lt;br /&gt;
Gijs&lt;br /&gt;
&lt;br /&gt;
I saw you had mentioned the issue with the JSON class.  I was wondering if you ever found a resolution for this problem. I support a wiki group and have been suffering for the last month trying to resolve this issue.  I would be grateful for any help.&lt;br /&gt;
&lt;br /&gt;
I am running mediawiki 1.22  with php 5.3.10&lt;br /&gt;
&lt;br /&gt;
On another note, I have been flying RC planes and gliders for years. I have wanted to get a simulator program.  Would this be a good one to start with ?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Many Thanks&lt;br /&gt;
&lt;br /&gt;
Peter&lt;br /&gt;
&lt;br /&gt;
: Hi Peter,&lt;br /&gt;
: like I said at [[FlightGear wiki:Village pump#Found bugs]]&lt;br /&gt;
: &amp;quot;The CategoryTree extension relies on a function that was removed as of 1.22.0, so the extensions needs some fixing. I've disabled it for now.&amp;quot;&lt;br /&gt;
: So my solution was to disable it. The extension itself needs fixing to work with more recent version of MediaWiki, that's not something I intended to do ;-)&lt;br /&gt;
: And yes, FlightGear would be a good simulator to start (and even stick) with. I'm biased though...&lt;br /&gt;
: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 09:56, 25 March 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Two bot jobs – Moving categories to plural form ==&lt;br /&gt;
&lt;br /&gt;
Hello Gijs, I got stumbled upon a request for a bot job that I added to [[User talk:BotFlightGear#Moving Category:List and Category:Resource to titles in plural form|User talk:BotFlightGear]] a while ago.  Just a gentle reminder. ;-)&lt;br /&gt;
&lt;br /&gt;
The requested moves are intended to be a part of trying to make the category names more logical and harder to mistype etc.&lt;br /&gt;
&lt;br /&gt;
—[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 14:51, 1 May 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
: Thanks for the reminder. He's [http://wiki.flightgear.org/Special:Contributions/BotFlightGear running]!&lt;br /&gt;
: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 15:33, 1 May 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Thank you kindly. :-)&lt;br /&gt;
:: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 15:48, 1 May 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== 06/2014 newsletter: too much of a mess ==&lt;br /&gt;
&lt;br /&gt;
: [http://wiki.flightgear.org/index.php?title=FlightGear_Newsletter_June_2014&amp;amp;curid=12417&amp;amp;diff=73490&amp;amp;oldid=73455 Use new templates; cleanup (except for Canvas stuff, which is too much of a mess right now))] &lt;br /&gt;
&lt;br /&gt;
:: Please feel free to clean up or just remove the &amp;quot;mess&amp;quot;. I realize that it's messy (Thorsten also said so recently), I added those things when we didn't have a whole lot of content, and I didn't bother writing anything from scratch, I just took stuff from the forum using the [[Instant-Cquotes]] script, which is why it's a bit  &amp;quot;messy&amp;quot;. &amp;lt;small&amp;gt;But if you should decide to clean it up, I'll volunteer to help cleaning up navdisplay.mfd::update() on your behalf&amp;lt;/small&amp;gt; ;-) --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 16:00, 29 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: Hi,&lt;br /&gt;
::: There's not just instant cquotes, but also sections with no text at all. Garmin and Aircraft Center for example. I don't know how someone who hasn't been following the progress is supposed to make sense out of that; which is why I think you're the best person to work on it. &lt;br /&gt;
:::: When I close the newsletter and &amp;quot;publish&amp;quot; it, I usually make sure the layout is somewhat readable. Right now that job would require more time than I have and/or would like to spend.&lt;br /&gt;
::: Cheers,&lt;br /&gt;
::: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 19:27, 30 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::: I've added instant-cquotes content from the corresponding wiki articles. Sorry for the mess, and thanks for the new newsletter layout - even though it's a bit awkward to edit now, can we still edit individual sections directly please ?--[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 19:41, 30 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
::::: Hey, good job - that looks indeed much better. I was wondering if we should slightly extend the template, and then simply port [[Instant-cquotes]] to optionally create tailored sections for the newsletter, i.e. without the cquote, and using galleries, what do you think ?--[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 20:37, 30 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:::::: With the new section titles (that come with an author field), we don't need those quotes to make clear who's saying stuff. I've changed them to running texts now, which is a lot nicer to read IMO. Doing that on the first run is a lot easier than doing it later on, as I had to dig up the posts, get acquainted with the subject etc. The script you're using adds quite some nasty HTML to the wiki (treating normal urls as wiki links, adding dozens of &amp;lt;nowiki&amp;gt;&amp;lt;br/&amp;gt;&amp;lt;/nowiki&amp;gt;, ignoring bullet lists), so I would suggest to not use it on large scale for now. If you can change it to produce running texts with correct wiki markup it would be a whole lot better ;-)&lt;br /&gt;
:::::: I'll have a look if we can re-enable sectional edits. Removing that was definitely unintended. My intention was to make the newsletter a little more appealing and less of an ordinary wiki article.&lt;br /&gt;
:::::: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 20:44, 30 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: right, what I am more concerned about is proper crediting-I already added Tom's nick twice there, because I wasn't involved in the development of the [[Aircraft Center]], I merely posted some updates on the forum-which is why the cquotes script used my nick, and it was obvious that it was just a quote-now it looked like I was announcing my own work. But obviously the credit should go to TheTom &amp;amp; Zakalawe. The changes you suggest should be straightforward still. --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 20:50, 30 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
::: The new &amp;quot;By&amp;quot; tag is not meant to be used to credit the person that the section is about. It is meant to show who's written that section. So if you write something about Tom's work, your name ends up under the tile &amp;quot;By Hooray&amp;quot;. Tom's name will end up in the text, where you can something along the lines of &amp;quot;Thanks to Tom's recent work...&amp;quot;. Some people are not happy with articles that appear to have been written by them when they are not.&lt;br /&gt;
::: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 20:59, 30 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: ok, thanks for clarifying - maybe we should simply make it '''Written by ''' (and '''Developed by''') then to be on the safe side, i.e. change the template accordingly ? --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 21:01, 30 June 2014 (UTC)&lt;br /&gt;
:: And just to be clear about it, I totally appreciate your work here, and I am looking forward to seeing if we can find a way to generalize the concept and reuse it for the changelog, even if that should just mean to partially include contents from 6 newsletters in it (as per [[FlightGear_wiki:Village_pump#Template_for_announcement_of_changes_and_new_features]]).--[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 21:05, 30 June 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Livery texture aspect ratio ==&lt;br /&gt;
&lt;br /&gt;
Did you accidentally remove the paragraph about that all liveries for an aircraft have to have the same aspect ratio in [http://wiki.flightgear.org/index.php?title=Howto:Edit_a_livery&amp;amp;diff=74832&amp;amp;oldid=74831 this edit]?&lt;br /&gt;
&lt;br /&gt;
Apart from that thanks for catching and fixing my ''very'' old error, n&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt; &amp;amp;rarr; 2&amp;lt;sup&amp;gt;n&amp;lt;/sup&amp;gt; ;-)&lt;br /&gt;
&lt;br /&gt;
—[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 15:31, 8 August 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
: No, it was deliberate. UVmaps use coordinates like 0.3*width, 0*heigth instead of absolute values (eg. 3rd pixel up, 15th pixel to the right). That's also why you can replace textures with different resolutions without having to edit the mapping.&lt;br /&gt;
: You'll probably get an overly stretched texture (since pixels will beno longer &amp;quot;squares&amp;quot;, as in the most likely ideal original mapping), but it is not impossible or principally wrong ;-)&lt;br /&gt;
: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 16:53, 8 August 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Thanks for the explanation.&lt;br /&gt;
:: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 18:58, 8 August 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== Strange infobox image bug ==&lt;br /&gt;
I recently found a very strange bug I can not wrap my head around.  It appears that an image from English Wikipedia is used instead of an image with the identical name on this wiki.&lt;br /&gt;
&lt;br /&gt;
When I looked at the rather new page {{plink|Yakovlev Yak-130|76122}} as well as the page I moved it from, I noticed that the aircraft picture is a photo and was about to edit the file page.  Instead of seeing a photo on the file page I see a FlightGear screenshot [[:File:Yak-130.jpg]].  The {{tl|infobox aircraft}} seems to be as it should be.  Going to English Wikipedia and looking for the image I find the very same image as I see rendered on the page, {{wikipedia|File:Yak-130.jpg}}.&lt;br /&gt;
&lt;br /&gt;
I have no idea what is going on.&lt;br /&gt;
&lt;br /&gt;
—[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 11:53, 10 September 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
: Hi,&lt;br /&gt;
: that seems to be an unwanted side-effect of [[mw:InstantCommons]]. In principle this shouldn't conflict, but I suspect someone did load the Commons image before uploading the one to our wiki. Thus, the Commons one ended up in the thumbnail cache.&lt;br /&gt;
: I've now disabled this feature, as I don't think we use it anywhere on the wiki. Not even sure why it was enabled in the first place...&lt;br /&gt;
: Cheers,&lt;br /&gt;
: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 14:44, 10 September 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
:: Thanks for the help.  I would not even have imagined.&lt;br /&gt;
:: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 16:08, 10 September 2014 (UTC)&lt;br /&gt;
&lt;br /&gt;
== PA32 deleted ==&lt;br /&gt;
&lt;br /&gt;
Hi  &lt;br /&gt;
&lt;br /&gt;
Noticed this is deleted - not enough info or inappropriate? Pls let me know. I have set myself a  personal goal to review over 35 civil aviation aircraft and upload screenshots.&lt;br /&gt;
&lt;br /&gt;
http://wiki.flightgear.org/index.php?title=Piper_PA-32&amp;amp;action=edit&amp;amp;redlink=1&lt;br /&gt;
&lt;br /&gt;
[[User:Openflight|Openflight]] ([[User talk:Openflight|talk]]) 01:26, 18 September 2015 (EDT)&lt;br /&gt;
&lt;br /&gt;
: Not enough info (nothing FlightGear specific). The only content was &amp;quot;The Piper PA 32 is a single engined aircraft built by Piper.&amp;quot; That's not what our wiki is for ;-) Feel free to restart the article if you've got more to write now.&lt;br /&gt;
: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 02:30, 18 September 2015 (EDT)&lt;br /&gt;
&lt;br /&gt;
Sure will do, thanks.  [[User:Openflight|Openflight]] ([[User talk:Openflight|talk]]) 02:44, 18 September 2015 (EDT)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Adding Table of Aircraft to Wiki page ==&lt;br /&gt;
&lt;br /&gt;
Hi, if it's ok , will edit Wiki home page and add link to table of aircraft as follows:&lt;br /&gt;
&lt;br /&gt;
Using&lt;br /&gt;
New to FlightGear&lt;br /&gt;
Frequently asked questions • Troubleshooting • List of aircraft •&lt;br /&gt;
Installing scenery • Installing aircraft&lt;br /&gt;
Helicopter flying&lt;br /&gt;
&lt;br /&gt;
My concern is those new to Flight Gear do not get to see the list of aircraft and the aircraft detaisl right away from Wiki home page or FG home page&lt;br /&gt;
&lt;br /&gt;
== Wrong link ==&lt;br /&gt;
&lt;br /&gt;
Hi Gijs!&lt;br /&gt;
You still have a link for our Gitorius account you know.&lt;br /&gt;
&lt;br /&gt;
== Red Leader's pygments Nasal lexer  ==&lt;br /&gt;
&lt;br /&gt;
Hi Gijs, referring to Red Leader's work at [http://wiki.flightgear.org/FlightGear_wiki:Village_pump#Nasal_Syntaxhighlighting], is there any way we/I can help to get this applied ? If you are too busy to handle/review this currently, can we get in touch with someone else who's got the corresponding access/privileges on the wiki (Curt, Simon?). Thanks --[[User:Hooray|Hooray]] ([[User talk:Hooray|talk]]) 09:19, 22 April 2016 (EDT)&lt;br /&gt;
&lt;br /&gt;
'''BUMP''' ?&lt;br /&gt;
&lt;br /&gt;
== Wiki Edits ==&lt;br /&gt;
&lt;br /&gt;
Gijs,&lt;br /&gt;
&lt;br /&gt;
Thanks for your recent edits of Howto pages I'm working on.  In my future posts, I'll try to follow suit with the style corrections you made.&lt;br /&gt;
&lt;br /&gt;
Is there a style guide I should read?&lt;br /&gt;
&lt;br /&gt;
[[User:Callahanp|Callahanp]] ([[User talk:Callahanp|talk]]) 07:55, 3 August 2016 (EDT)&lt;br /&gt;
&lt;br /&gt;
: Hi,&lt;br /&gt;
: there is, at [[FlightGear wiki:Manual of Style]]. [[Help:Formatting]] may also be useful to consult when you're in doubt about certain things. I mostly changed some minor things that you now know how to do &amp;quot;correct&amp;quot;, so don't be afraid to make mistakes. We're very pleased with your contributions!&lt;br /&gt;
: Cheers,&lt;br /&gt;
: [[User:Gijs|Gijs]] ([[User talk:Gijs|talk]]) 10:44, 3 August 2016 (EDT)&lt;br /&gt;
&lt;br /&gt;
== SOTM in the Newsletter of August 2016 ==&lt;br /&gt;
&lt;br /&gt;
Hi Gijs, would you please add the following text to August's Newsletter (below the &amp;quot;Screenshots&amp;quot; section)?&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
==== Screenshot of the Month ====&lt;br /&gt;
FlightGear's Screenshot of the Month August 2016 is ''Bad weather take off from EDDI'' by {{usr|Dg-505|Jonathan S. (Dg-505)}}&lt;br /&gt;
[[File:Ju-52 taking off from EDDI.jpg|900px|center|Bad weather take off from EDDI]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you want to participate in the screenshot contest of September 2016, you can submit your candidate to [https://forum.flightgear.org/viewtopic.php?f=19&amp;amp;t=30364 this] forum topic. Be sure to see the [https://forum.flightgear.org/viewtopic.php?f=19&amp;amp;t=30364#p293984 first post] for participation rules. For purposes of convenience and organization, after all the entries have been submitted, a new forum topic will be started containing all shots in an easy-to-view layout. The voting will then take place there. Once the voting has finished, the best screenshot will be presented in the Newsletter edition of September 2016.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
Jonathan&lt;br /&gt;
&lt;br /&gt;
: {{done}}&lt;br /&gt;
: [[User:Red_Leader|&amp;lt;span style=&amp;quot;color:red&amp;quot;&amp;gt;'''''Red Leader'''''&amp;lt;/span&amp;gt;]] ([[User_talk:Red_Leader|Talk]], [[Special:Contributions/Red_Leader|contribs]]) 11:30, 8 September 2016 (EDT)&lt;br /&gt;
&lt;br /&gt;
Thank you :-)&lt;br /&gt;
&lt;br /&gt;
[[User:Dg-505|Dg-505]] ([[User talk:Dg-505|talk]]) 11:50, 8 September 2016 (EDT)&lt;br /&gt;
&lt;br /&gt;
== Oversight/deletion of images ==&lt;br /&gt;
&lt;br /&gt;
Hello Gijs! I was wondering if it would be at all possible for you to completely [https://en.wikipedia.org/wiki/Wikipedia:Oversight oversight] or, if that's not possible here, to just completely delete the pages [[File:Split shapefiles.png]] and '''File:Split shapefiles rm.png'''. When I uploaded the screenshot, I forgot to exclude a name I would have preferred not become associated with my alias IskenderWang, in the interest of privacy. Once this matter is resolved, you don't need to let me know, in fact you can delete this talk page entry itself as well. I would greatly appreciate any help. Cheers! [[User:IskenderWang|IskenderWang]] ([[User talk:IskenderWang|talk]]) 06:09, 14 October 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:Shapefiles_split.png&amp;diff=133488</id>
		<title>File:Shapefiles split.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:Shapefiles_split.png&amp;diff=133488"/>
		<updated>2021-10-14T05:55:00Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Shapefiles directory, now with split shapefiles&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:QGIS_example_for_TG_2.png&amp;diff=133483</id>
		<title>File:QGIS example for TG 2.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:QGIS_example_for_TG_2.png&amp;diff=133483"/>
		<updated>2021-10-14T05:38:46Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Screenshot of QGIS displaying shapefiles for TG use&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:QGIS_example_for_TG_1.png&amp;diff=133482</id>
		<title>File:QGIS example for TG 1.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:QGIS_example_for_TG_1.png&amp;diff=133482"/>
		<updated>2021-10-14T05:37:07Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Screenshot of QGIS displaying shapefiles for TG use&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=File:TG_directory_structure.png&amp;diff=133481</id>
		<title>File:TG directory structure.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=File:TG_directory_structure.png&amp;diff=133481"/>
		<updated>2021-10-14T03:23:27Z</updated>

		<summary type="html">&lt;p&gt;IskenderWang: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;A directory format one could expect to utilize while working with TG&lt;/div&gt;</summary>
		<author><name>IskenderWang</name></author>
	</entry>
</feed>