V2 Airport .apt file format
V2 Airport .apt file format
Condor scenery newbie here.
I see that airports are defined in the .apt file but the I can't decipher the file format. Is there a document that gives the format or can someone provide it? I would like to create a little utility to take a .cup file, extract the airports and create the .apt file. The utility would also spit out a separate file just with turnpoints.
Also is the elevation, length and width all in meters? Is the second entry field under direction for a 2nd runway?
Thanks!
Eric
I see that airports are defined in the .apt file but the I can't decipher the file format. Is there a document that gives the format or can someone provide it? I would like to create a little utility to take a .cup file, extract the airports and create the .apt file. The utility would also spit out a separate file just with turnpoints.
Also is the elevation, length and width all in meters? Is the second entry field under direction for a 2nd runway?
Thanks!
Eric
Eric
LS-4a - "QW"
LS-4a - "QW"
Re: V2 Airport .apt file format
Hey, here's some very dirty Python code to read the .apt file, hopefully it helps. Everything is in meters:
Code: Select all
with open("airport.apt", "rb") as afile:
while True:
len = struct.unpack("B", afile.read(1))[0]
name = afile.read(len)
print(name)
padding = afile.read(0x23 - len)
lat, lon, alt, direction, length, width, d1, d2, d3 = struct.unpack("<fffllllll", afile.read(36))
if (direction > 365):
direction = (direction - 100000) / 100 + ((direction % 100) / 100.0)
print(lat, lon, alt, direction, length, width, d1, d2, d3)
Re: V2 Airport .apt file format
Thanks for speedy response.
I am a Java guy, not Python, but thought I would give it a try and perhaps reverse engineer a Java solution. But am getting the following error.
len = struct.unpack("B", afile.read(1))[0]
NameError: name 'struct' is not defined
Thoughts?
Eric
I am a Java guy, not Python, but thought I would give it a try and perhaps reverse engineer a Java solution. But am getting the following error.
len = struct.unpack("B", afile.read(1))[0]
NameError: name 'struct' is not defined
Thoughts?
Eric
Eric
LS-4a - "QW"
LS-4a - "QW"
Re: V2 Airport .apt file format
Sorry, you'll need an "import struct" at the top of the file, and maybe a few more? It's a fragment from a larger script, here's all of them from there:
struct.unpack calls describe the binary format - https://docs.python.org/3/library/struc ... characters.
Code: Select all
import io
import sys
import re
import struct
import csv
import math
Re: V2 Airport .apt file format
Thanks again. Added above imports and running now. Now need to look at code vs output to figure out what's what. File format in plain English (or any language) would still be good!
Eric
LS-4a - "QW"
LS-4a - "QW"
Re: V2 Airport .apt file format
Thanks again. Added above imports and running now. Now need to look at code vs output to figure out what's what. File format in plain English (or any language) would still be good!
Eric
LS-4a - "QW"
LS-4a - "QW"
Re: V2 Airport .apt file format
It's basically a 36-character string for name, with length in the leading byte, followed by 3 floats and 6 longs, 4 bytes each, little-endian.
Re: V2 Airport .apt file format
May not be updated with latest update (when orientation>365°, the orientation must be divided by 100 to obtain a precise value):
.apt format 72 bytes per airport, file size/72=nb of airport
1 byte: length of the name
35 bytes: name of the airport
float : latitude (in °)
float: longitude (in °)
float : altitude (in m.)
int : orientation (in °)
int : length of the runway
int : runway width
int = 1=asphalt
float: frequency
boolean (1 byte): track info flag (1=primary dir reversed)
boolean (1 byte) : track info flag (1=tow primary dir left side)
boolean (1 byte) : track info flag (1=tow secondary dir left side)
1 empty byte
.apt format 72 bytes per airport, file size/72=nb of airport
1 byte: length of the name
35 bytes: name of the airport
float : latitude (in °)
float: longitude (in °)
float : altitude (in m.)
int : orientation (in °)
int : length of the runway
int : runway width
int = 1=asphalt
float: frequency
boolean (1 byte): track info flag (1=primary dir reversed)
boolean (1 byte) : track info flag (1=tow primary dir left side)
boolean (1 byte) : track info flag (1=tow secondary dir left side)
1 empty byte
Re: V2 Airport .apt file format
Altitude is not used by Condor anymore (uses terrain data), but must be present.
CN: MPT — CondorUTill webpage: https://condorutill.fr/