aerofiles.aixm

class aerofiles.aixm.AixmAirspaceParser

Parse an AIXM 5.1.1 document to find all Airspaces:

parser = AixmAirspaceParser.AixmAirspaceParser()
airspaces, borders = parser.parse(args.xml)
parser.resolve()
if parser.contains_curveref:
    print(f'WARN: the AIXM file contains references curves. For "Germany" we recommend "ED_Airspace_StrokedBorders...xml"')

Use parser.resolve() to resolve all referenced Airspaces.

parse(xml)

Parse the given AXML 5.1.1 document and returns all airspaces and borders.

resolve()

Walk through all airspaces and resolve airspace.component. If an airspace has AirspaceVolumes with dependencies, these will be collected and replaced with the referenced Volumes.

This means, that after calling this method, all airspaces will have only airspace.components and no dependencies. This will ease the usage of airspaces by following methods.

class aerofiles.aixm.AixmOpenairConverter(airspaces, borders, convert_DA_to_DB=False)

Convert all AIXM airspaces returned from AixmAirspaceParser into openair records. These can then be written by aerofiles.openair.writer:

parser = AixmAirspaceParser.AixmAirspaceParser()
airspaces, borders = parser.parse("airspace-aixm.xml")
converter = AixmAirspaceParser.AixmOpenairConverter()
openairs = converter.convert_airspaces(airspaces)

fp = open("airspace-openair.txt", 'wb')
writer = aerofiles.openair.writer.Writer(fp)
for openair in openairs:
    writer.write_record(openair)
class aerofiles.aixm.AixmGeometryResolver(arc_angle_step=1)

This class converts AIXM gemoetries (Arc, Circle, ..) into single points. This means, after the conversion, the airspaces will only contains points:

parser = AixmAirspaceParser.AixmAirspaceParser()
airspaces, borders = parser.parse("airspace-aixm.xml")
resolver = AixmGeometryResolver()
resolver.resolve_airspaces(airspaces)
converter = AixmAirspaceParser.AixmOpenairConverter()
openairs = converter.convert_airspaces(airspaces)

fp = open("airspace-openair.txt", 'wb')
writer = aerofiles.openair.writer.Writer(fp)
for openair in openairs:
    writer.write_record(openair)

arc_angle_step is the number of degrees, which will be used to convert arcs into points. A value of 1 means, that a circle has 360 points.