177
edits
Chris blues (talk | contribs) (→SIDs and STARs: added bash script for sorting xml-files into I/C/A/ICAO.procedures.xml) |
|||
Line 59: | Line 59: | ||
* If you have Ruby installed on your computer, you can use [http://files.goneabitbursar.com/fg/install-navdat.rb this renaming script]. | * If you have Ruby installed on your computer, you can use [http://files.goneabitbursar.com/fg/install-navdat.rb this renaming script]. | ||
* Another possibility, using [https://www.python.org/ Python] 3, is this [http://people.via.ecp.fr/~flo/python_dumping_ground/short_scripts/extract-navdata.py extract-navdata.py script], which can install the files from a directory or directly from a tarball. Run <tt>extract-navdata.py --help</tt> or <tt>python3 extract-navdata.py --help</tt> for instructions. You may need to use <tt>py -3</tt> instead of <tt>python3</tt> on Windows, cf. [https://docs.python.org/3/using/windows.html Using Python on Windows]. | * Another possibility, using [https://www.python.org/ Python] 3, is this [http://people.via.ecp.fr/~flo/python_dumping_ground/short_scripts/extract-navdata.py extract-navdata.py script], which can install the files from a directory or directly from a tarball. Run <tt>extract-navdata.py --help</tt> or <tt>python3 extract-navdata.py --help</tt> for instructions. You may need to use <tt>py -3</tt> instead of <tt>python3</tt> on Windows, cf. [https://docs.python.org/3/using/windows.html Using Python on Windows]. | ||
* You could also use a small bash-script to do the work for you. Bash is a shell, native on Linux, also exists on Macs. Copy the following code into a new file, name it "convert.sh". Put it into the lowest directory, where all the xml-files are stored. | |||
<syntaxhighlight lang="bash" enclose="div">#!/bin/bash | |||
for file in *.xml | |||
do | |||
FILENAME=$( echo $file | sed s/.xml// ) | |||
DIR=$( echo "$FILENAME" | sed s/[A-Z0-9]\$// ) | |||
ONE=$( echo "$DIR" | sed s/[A-Z0-9]\$// | sed s/[A-Z0-9]\$// ) | |||
TWO=$( echo "$DIR" | sed s/[A-Z0-9]// | sed s/[A-Z0-9]\$// ) | |||
THREE=$( echo "$DIR" | sed s/[A-Z0-9]// | sed s/[A-Z0-9]// ) | |||
#echo "$file => $DIR => $ONE / $TWO / $THREE / $file" | |||
mkdir -pv "../Airports/$ONE/$TWO/$THREE" | |||
cp -v $file "../Airports/$ONE/$TWO/$THREE/$FILENAME.procedures.xml" | |||
done | |||
</syntaxhighlight> | |||
Now it's time to fire up a terminal and navigate to the files: | |||
<code>cd /path/to/LevelD/package</code> | |||
To make the script executable type: | |||
<code>chmod +x convert.sh</code> | |||
Now you're ready to run the script! | |||
<code>./convert.sh</code> | |||
When the script is done, you will find a new folder on your hard-disk: "/path/to/LevelD/Airports" which contains the files in our "I/C/A/ICAO.procedures.xml fashion". | |||
Next time you start FlightGear, you can load the routes through the route manager interface. | Next time you start FlightGear, you can load the routes through the route manager interface. |
edits