Developing an Open Source AIXM5
Java Library
(AIXM-J)
Steven Chase
Lead Software Engineer
MITRE/CAASD
March 19, 2008
© 2008 The MITRE Corporation. All rights reserved.
Overview
• Background
– Tools
– Data sources
• Open source project
– Goals
– Technology
– Challenges
– Status
– Using the library
• Demo
2
© 2008 The MITRE Corporation. All rights reserved.
MITRE/CAASD Background
• The MITRE Corporation
– Private, independent, not-for-profit organization
– Chartered to work in the public interest
• CAASD
– Federally Funded Research & Development Center
(FFRDC) operated by MITRE
– Provides systems research and development for
the Federal Aviation Administration (FAA) and
international civil aviation authorities
3
© 2008 The MITRE Corporation. All rights reserved.
CAASD Developed Tools
• Procedure design,
flyability, simulation,
visualization
TARGETS
4
• ILS approach/airport
safety analysis, CRM
Safety Assessment Toolset
© 2008 The MITRE Corporation. All rights reserved.
Data Sources
•
•
•
•
•
National Flight Data Center (NFDC/NASR)
AVN Information Services (AVNIS)
Jeppesen
National Aeronautical Charting Office (NACO)
Digital Aeronautical Flight Information File
(DAFIF)
• Digital Obstacle File (DOF)
• Elevation Data (DEM, DTED, etc)
5
© 2008 The MITRE Corporation. All rights reserved.
Goals
• Develop AIXM5 Java library that is:
– Independent
– Easy to use
– Well documented
– Extensible
– AIXM5 compliant
• Enable applications to read/write AIXM5 data
• Handle large data sets
6
© 2008 The MITRE Corporation. All rights reserved.
Technology
• Sun JDK (5 or greater)
– Enum, generics, enhanced for loop, etc.
• Dom4j
– Library for using XML, XPath (jaxen) and XSLT
– Full support for DOM, SAX and JAXP
– Easy, fast, open source
• Why not use JAXB or XMLBeans?
– In early versions, not all AIXM5 schema elements and
attributes were supported
– Auto-generated code may be hard to work with
– Other attempts have been made
7
© 2008 The MITRE Corporation. All rights reserved.
Challenges
• Understanding the model
• Model is still changing
• Sample XML is limited
• Implementing GML
8
© 2008 The MITRE Corporation. All rights reserved.
Status
• Features
– AirportHeliport
– Runway
– Navaid
– Designated
Point
– Vertical
Structure
– STAR/SID
– Basic Message
– GML Point and
ValidTime
<aixm:VerticalStructure xmlns:aixm="http://www.aixm.aero/schema/5.0"
gml:id="19608436">
<aixm:timeSlice>
<aixm:VerticalStructureTimeSlice gml:id="26795951">
<aixm:name>TEST OBSTACLE</aixm:name>
<aixm:type>POLE</aixm:type>
<aixm:constructionStatus>COMPLETED</aixm:constructionStatus>
<aixm:material>STEEL</aixm:material>
<aixm:markingPattern>STEEL</aixm:markingPattern>
<aixm:markingFirstColour>RED</aixm:markingFirstColour>
<aixm:markingSecondColour>BLACK</aixm:markingSecondColour>
<aixm:markingICAOStandard>YES</aixm:markingICAOStandard>
<aixm:group>NO</aixm:group>
<aixm:isMadeOf>
<aixm:VerticalStructurePart gml:id="25276323">
<aixm:verticalExtent uom="FT">500.0</aixm:verticalExtent>
<aixm:verticalExtentAccuracy uom="FT">10.0</aixm:verticalExtentAccuracy>
<aixm:hasPointShape>
<aixm:ElevatedPoint gml:id="20051738">
<gml:pos>70.0 -122.0</gml:pos>
<aixm:elevation uom="FT">1500.0</aixm:elevation>
<aixm:geoidUndulation uom="M">212.0</aixm:geoidUndulation>
<aixm:verticalDatum>EGM96</aixm:verticalDatum>
<aixm:horizontalAccuracy uom="M">15.0</aixm:horizontalAccuracy>
<aixm:verticalAccuracy uom="M">10.0</aixm:verticalAccuracy>
</aixm:ElevatedPoint>
</aixm:hasPointShape>
</aixm:VerticalStructurePart>
</aixm:isMadeOf>
</aixm:VerticalStructureTimeSlice>
</aixm:timeSlice>
</aixm:VerticalStructure>
Sample XML – Vertical Structure
9
© 2008 The MITRE Corporation. All rights reserved.
Status (ctd)
• Includes sample programs that read/write AIXM5
– XML has not been validated
• Uses GNU General Public License (GPL)
• Hosted on Sourceforge
– http://sourceforge.net/projects/aixm-j
10
© 2008 The MITRE Corporation. All rights reserved.
Using the Library
• Add aixm-j, dom4j, jaxen jar files to classpath
Your
Application
Aviation
Objects
Convert to
AIXM-J Objects
AIXM-J Library
Objects
dom4j
AIXM5 XML
Generating AIXM5 XML
11
© 2008 The MITRE Corporation. All rights reserved.
Demo
12
© 2008 The MITRE Corporation. All rights reserved.
Document Number Here
13
© 2008 The MITRE Corporation. All rights reserved.
Sample Code/Notes
14
© 2008 The MITRE Corporation. All rights reserved.
Sample Conversion Method
// Takes an Airport object and returns an AixmFeature object
public static AixmFeature createAixmAirport(Airport airport) {
// create an AixmFeature object
AixmFeature ah = new AixmFeature(AixmFeatureType.AirportHeliport);
// create an AixmAirportHeliportTimeSlice
AixmAirportHeliportTimeSlice timeSlice = new AixmAirportHeliportTimeSlice();
// set gmlId
timeSlice.setGmlId(String.valueOf(airport.getUniqueKey()));
// set designator
timeSlice.setDesignator(airport.getAirportId());
// set elevation
AixmVerticalDistanceValue fieldElevation =
new AixmVerticalDistanceValue(airport.getElevation(),
AixmUomDistanceVerticalType.FT);
timeSlice.setFieldElevation(fieldElevation);
// set rest of fields here…
// add the timeSlice to AirportHeliport
ah.addTimeSlice(timeSlice);
// return the AixmFeature object
return ah;
15
}
© 2008 The MITRE Corporation. All rights reserved.
Generating AIXM5 XML
// Convert airport to AixmFeature object
AixmFeature aixmAirport = AixmAirportUtil.createAixmAirport(airport);
// Create dom4j Document
Document document = DocumentHelper.createDocument();
// Create the root Element
QName qname = QName.get(“AirportHeliport”, AixmConstants.AIXM_NAMESPACE);
Element rootElement = DocumentHelper.createElement(qname);
// Set the root Element, XPath won’t work until you do this
document.setRootElement(element);
// Call AIXM-J method to add dom4j Elements to represent the airport
aixmAirport.addElements(rootElement, document);
// Pretty print the document
OutputFormat formatter = OutputFormat.createPrettyPrint();
try {
XMLWriter writer = new XMLWriter(System.out, formatter);
writer.write(document);
writer.flush();
}
catch (Exception ex) {
ex.printStackTrace();
}
16
© 2008 The MITRE Corporation. All rights reserved.
Generated XML
<?xml version="1.0" encoding="UTF-8"?>
<aixm:AirportHeliport xmlns:aixm="http://www.aixm.aero/schema/5.0" xmlns:gml="http://www.opengis.n
<aixm:timeSlice>
<aixm:AirportHeliportTimeSlice gml:id="1576249658">
<aixm:designator>KIAD</aixm:designator>
<aixm:name>WASHINGTON DULLES INTL</aixm:name>
<aixm:locationIndicatorICAO>K6KIAD</aixm:locationIndicatorICAO>
<aixm:type>AD</aixm:type>
<aixm:private>NO</aixm:private>
<aixm:elevation uom="FT">313.0</aixm:elevation>
<aixm:serves>
<aixm:City gml:id="org.mitre.caasd.aixm.data.AixmCity15925147">
<aixm:name>WASHINGTON</aixm:name>
</aixm:City>
</aixm:serves>
<aixm:magneticVariation>-10.0</aixm:magneticVariation>
<aixm:dateMagneticVariation>2000</aixm:dateMagneticVariation>
<aixm:hasReferencePoint>
<aixm:ElevatedPoint xmlns:aixm="http://www.aixm.aero" gml:id="23811352">
<gml:pos>38.94453194444444 -77.45580972222223</gml:pos>
<aixm:elevation uom="FT">313.0</aixm:elevation>
</aixm:ElevatedPoint>
</aixm:hasReferencePoint>
…
17
© 2008 The MITRE Corporation. All rights reserved.
Parsing an AIXM5 ILS File
// Open the file, create a BufferedReader and SAXReader
FileInputStream is = new FileInputStream(new File("ILS.aixm.xml"));
BufferedReader br = new BufferedReader(new InputStreamReader(is));
SAXReader saxReader = new SAXReader();
// Add handler for each Navaid tag
saxReader.addHandler("/ils-subscriber-file/Navaid", new ElementHandler() {
public void onEnd(ElementPath path) {
Element navaidElement = path.getCurrent();
// Convert the dom4j Element to an AixmFeature object
AixmFeature navaid = new
AixmFeature(AixmFeatureType.Navaid).parseElements(navaidElement);
// Do something with the data here, in this example we just print the object
System.out.println("navaid : " + navaid);
// Free up memory
navaidElement.detach();
}
public void onStart(ElementPath path) {/* do nothing */}
} );
// Read the XML file
saxReader.read(br);
18
© 2008 The MITRE Corporation. All rights reserved.
Notes
• AIXM – Aeronautical Information Exchange Model (AIXM) is designed to enable the
management and distribution of Aeronautical Information Services (AIS) data in digital
format
• XMLBeans – XMLBeans is a technology for accessing XML by binding it to Java types
• JDK – Java Development Kit, includes Java compiler, runtime environment, etc.
• JAXB – The Java Architecture for XML Binding
• SAX – Simple API for XML (SAX) is a serial access parser API for XML; event driven;
user defines callback methods that are called during parsing
• DOM – Document Object Model (DOM) is a standard object model for representing
XML formats; tree based model
• JAXP – Java API for XML Processing
• XPath – Xml Path (XPath) is a language for selecting nodes from an XML document
• Jaxen – Java XPath Engine (Jaxen) is an open source XPath library for Java
• Dom4j – dom4j is an easy to use, open source library for working with XML, XPath
and XSLT
• XSLT – Extensible Stylesheet Language Transformations (XSLT) is a language for
transforming XML documents into other XML documents
19
© 2008 The MITRE Corporation. All rights reserved.
Notes (ctd)
• CAASD – Center for Advanced Aviation System
Development, operated by MITRE
• TARGETS – Terminal Area Route Generation,
Evaluation and Traffic Simulation
• ILS – Instrument Landing System
• CRM – Collision Risk Model
• DEM – Digital Elevation Model
• DTED – Digital Terrain Elevation Data
• NASR – National Airspace System Resources
20
© 2008 The MITRE Corporation. All rights reserved.