Using the Custom Scenery TerraGear Toolset: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Add new instructions for TerraGear. These are definitive)
 
No edit summary
Line 29: Line 29:


The best elevation data currently available is from the Shuttle Radar Topography Mission (SRTM). There are two types of SRTM  data:
The best elevation data currently available is from the Shuttle Radar Topography Mission (SRTM). There are two types of SRTM  data:
- Highly accurate 1-arcsecond resolution data, known as SRTM-1, for the USA
* Highly accurate 1-arcsecond resolution data, known as SRTM-1, for the USA
- Less accurate 3-arcsecond data, known as SRTM-3, for the rest of the world.
* Less accurate 3-arcsecond data, known as SRTM-3, for the rest of the world.


From now on, we'll assume you are using SRTM-3 data. Unless otherwise noted, the process for SRTM-1 is identical.
From now on, we'll assume you are using SRTM-3 data. Unless otherwise noted, the process for SRTM-1 is identical.
Line 38: Line 38:
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. Use a shell script like the following to unzip all the files:
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. Use a shell script like the following to unzip all the files:


for i in *.zip
  for i in *.zip
do
  do
unzip $i
    unzip $i
done
  done


Now we've unzipped the data, we need to convert it into TerraGear format files in our work directory. The command to use for this is hgtchop. First create a work/SRTM-30 directory. Again, use a shell script to convert each of the files in turn:
Now we've unzipped the data, we need to convert it into TerraGear format files in our work directory. The command to use for this is hgtchop. First create a work/SRTM-30 directory. Again, use a shell script to convert each of the files in turn:


for i in *.hgt
  for i in *.hgt
do
  do
hgtchop 3 $i work/SRTM-30
    hgtchop 3 $i work/SRTM-30
done
  done
 
Isn't bash wonderful!


If you're using 1-degree data, replace the hgtchop command with "hgtchop 1 $i work/SRTM-1".
If you're using 1-degree data, replace the hgtchop command with "hgtchop 1 $i work/SRTM-1".
Line 58: Line 60:
Change directory to work/SRTM-30 and run  
Change directory to work/SRTM-30 and run  


terrafit.py .
  terrafit.py .


This will recurse into each of the directories and create .fit.gz files with fitted elevation data.
This will recurse into each of the directories and create .fit.gz files with fitted elevation data.
Line 68: Line 70:
Now we've got elevation data, we can generate our airports. First, create a data/airports 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 TaxiDraw.
Now we've got elevation data, we can generate our airports. First, create a data/airports 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 TaxiDraw.


The command to create airportshttp://mapserver.flightgear.org/download.psp is "genapts". Run it without any arguments to see the various command-line options.
The command to create airports is "genapts". Run it without any arguments to see the various command-line options.


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.
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.
Line 74: Line 76:
If you are just creating a single airport and you know the ICAO ID (e.g. KSFO, EGPH, EG32), use is as follows from your root scenery directory (i.e. the directory above your data, work and output directories).
If you are just creating a single airport and you know the ICAO ID (e.g. KSFO, EGPH, EG32), use is as follows from your root scenery directory (i.e. the directory above your data, work and output directories).


genapts --input=data/airports/apt.dat --work=./work --airport=<AIRPORT_ID>
  genapts --input=data/airports/apt.dat --work=./work --airport=<AIRPORT_ID>


If you are generating a larger set of scenery, then you can specify the minimum and maximum longitude and latitude.
If you are generating a larger set of scenery, then you can specify the minimum and maximum longitude and latitude.
Line 93: Line 95:
* Point data. This is currently only used for defining towns.
* Point data. This is currently only used for defining towns.
   
   
By far the easiest way to get this data is to download shape-files from the wonderful http://mapserver.flightgear.org. This provides access to a database of information, and allows you to download the specifi shapefiles for your scenery area. Click on the Download Shapefiles link (or go direct: http://mapserver.flightgear.org/download.psp). Enter in the bounding box of the scenery you want to generate, select the shapefiles you want, and click download. For your first scenery generation, you want all of the ones listed under VMap0 (with prefix v0_).  
By far the easiest way to get this data is to download shape-files from the wonderful http://mapserver.flightgear.org. This provides access to a database of information, and allows you to download the specifi shapefiles for your scenery area. Click on the Download Shapefiles link (or go direct: http://mapserver.flightgear.org/download.psp). Enter in the bounding box of the scenery you want to generate, select the shapefiles you want, and click download. For your first scenery generation, you want all of the ones listed under VMap0 (with prefix v0_).  
   
   
Download each of them into a data/shapefiles directory.
Download each of them into a data/shapefiles directory.


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!
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.).
Later on, you can experiment with replacing various shapefiles with other versions (GSHHS for coastline, OSM for roads etc.).
Line 115: Line 117:


   shape-decode --max-segment 500 data/shapefiles/v0_landmass work/Landmass Default
   shape-decode --max-segment 500 data/shapefiles/v0_landmass work/Landmass Default
 
 
To create streams of width 10 metres
To create streams of width 10 metres


   shape-decode --max-segment 500 --line-width 10 data/shapefiles/v0_stream work/Stream Stream
   shape-decode --max-segment 500 --line-width 10 data/shapefiles/v0_stream work/Stream Stream
 
 
To generate some towns about 1km across
To generate some towns about 1km across


   shape-decode --point-width 500 data/shapefiles/v0_town work/Town Town
   shape-decode --point-width 500 data/shapefiles/v0_town work/Town Town
 
 
Run this command for each shapefile in the set.
Run this command for each shapefile in the set.
    
    
Line 130: Line 132:
You will now have a work directory looking something like this:
You will now have a work directory looking something like this:


AirportArea          SRTM-30
  AirportArea          SRTM-30
AirportObj            Stream
  AirportObj            Stream
Bog                  IrrCropPastureCover    Town
  Bog                  IrrCropPastureCover    Town
Lake                  Urban                  Landmass
  Lake                  Urban                  Landmass
Railroad              DryCropPastureCover  Road
  Railroad              DryCropPastureCover  Road
EvergreenBroadCover  Marsh                  Sand
  EvergreenBroadCover  Marsh                  Sand
MixedCropPastureCover ScrubCover
  MixedCropPastureCover ScrubCover
GrassCover            MixedForestCover      Shared
  GrassCover            MixedForestCover      Shared


Now we can actually generate the scenery. This is done by the fgfs-construct command. Run the command with "--help" to get usage information.  
Now we can actually generate the scenery. This is done by the fgfs-construct command. Run the command with "--help" to get usage information.  
Line 159: Line 161:
Below is a list of common problems and solutions. If in doubt - google. Many problems have been hit before:
Below is a list of common problems and solutions. If in doubt - google. Many problems have been hit before:


- Crashes in genapts. Sometimes genapts will crash when dealing with a particular airport. In that case, try running it again with the --start-id argument to start at the airport it failed on, and the --nudge argument which tries to nudge the calculations in the right direction.
* Crashes in genapts. Sometimes genapts will crash when dealing with a particular airport. In that case, try running it again with the --start-id argument to start at the airport it failed on, and the --nudge argument which tries to nudge the calculations in the right direction.
- fgfs-construct Killed. On an Ubuntu system, the fgfs-construct process may be killed as it is using too many system resources. A simple solution is to generate smaller blocks of scenery, by using smaller --xdist and --ydist arguments.
* fgfs-construct Killed. On an Ubuntu system, the fgfs-construct process may be killed as it is using too many system resources. A simple solution is to generate smaller blocks of scenery, by using smaller --xdist and --ydist arguments.
- 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-30 directory.
* 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-30 directory.
- Only the airports appear in the scenery. There are three causes for this: 1) You didn't download the correct shapefiles for the area. 2) You haven't run shape-decode on the v0_landmass shapefile as Default 3) You didn't include the correct directories in fgfs-construct.
* Only the airports appear in the scenery. There are three causes for this: 1) You didn't download the correct shapefiles for the area. 2) You haven't run shape-decode on the v0_landmass shapefile as Default 3) You didn't include the correct directories in fgfs-construct.

Navigation menu