Version Tests Code Climate Donorbox


Partial implementation of the Aeronautical Information Exchange Model (AIXM 4.5) and it's dialect Open FlightMaps eXchange format (OFMX 0) for Ruby.

For now, only the parts needed to automize the AIP import of open flightmaps are part of this gem. Most notably, the gem is only a builder for snapshot files and does not parse them.



This gem is cryptographically signed in order to assure it hasn't been tampered with. Unless already done, please add the author's public key as a trusted certificate now:

gem cert --add <(curl -Ls


Add the following to the Gemfile or gems.rb of your Bundler powered Ruby project:

gem aixm

And then install the bundle:

bundle install --trust-policy MediumSecurity


If you're only going to use the executables, make sure to have the latest version of Ruby and then install this gem:

gem install aixm --trust-policy MediumSecurity


Here's how to build a document object, populate it with a simple feature and then render it as AIXM:

document = AIXM.document(
  region: 'LF'
    id: "ABIXI",
    xy: AIXM.xy(lat: %q(46°31'54.3"N), long: %q(002°19'55.2"W)),
    type: :icao

You can initialize all elements either traditionally or by use of the corresponding shorthand AIXM class method. The following two statements are identical:

See AIXM::CLASSES for the complete list of shorthand names.



The schema is either :aixm (default) or :ofmx:

AIXM.config.schema = :ofmx   # =>:ofmx

There are shortcuts to set and get the schema:

AIXM.schema             # => :aixm
AIXM.aixm?              # => true
AIXM.ofmx!              # => :ofmx
AIXM.ofmx?              # => true
AIXM.schema             # => :ofmx
AIXM.schema(:version)   # => 0


The :ofmx schema requires the region to be set on all core features. You can do so on individual features, however, you might want to configure a default region to simplify your life:

AIXM.region = 'LF'

:warning: This setting has no effect when using the :aixm schema.


In order to insert OFMX-compliant mid attributes into all *Uid elements, you have set the mid configuration option to true.

AIXM.config.mid          # => false - don't insert mid attributes by default
AIXM.config.mid = true   # => true  - insert mid attributes



In case you want to ignore certain XML schema validation errors, set this configuration option to a regular expression which matches the error messages to ignore. By default, no errors are ignored.

AIXM.config.ignored_errors = /invalid date/i






The different models are interwoven with has_many and has_one associations.

Please note that has_many associations are instances AIXM::Association::Array which mostly behave like normal arrays. However, you must not add or remove elements on the array directly but use the corresponding method on the associating model instead:

document.features << airport   # => NoMethodError
document.add_feature airport   # okay

find_by and find

Use find_by on has_many to filter associations by class and optional attribute values:

document.features.find_by(:airport)               # => [#<AIXM::Feature::Airport>, #<AIXM::Feature::Airport>]
document.features.find_by(:airport, id: 'LFNT')   # => [#<AIXM::Feature::Airport>]

To search a has_many association for equal objects, use find:

document.features.find(airport)   # => [#<AIXM::Feature::Airport>]

This may seem redundant at first, but keep in mind that two instances of +AIXM::CLASSES+ which implement #to_uid are considered equal if they are instances of the same class and both their UIDs as calculated by #to_uid are equal. Attributes which are not part of the #to_uid calculation are irrelevant!


Equally on has_many associations, use duplicates to find identical or equal associations:

document.features.duplicates   # => [#<AIXM::Feature::Unit>, #<AIXM::Component::Service>, ...]

Payload Hash

OFMX defines a payload hash function used to facilitate association and modification tracking. It is used internally, but you can also use it in your own code:

# Payload hash of XML fragment string
xml = '<xml><a></a></xml>'

# Payload hash of Nokogiri XML fragment
document ="file.xml") { Nokogiri::XML(_1) }


AIXM::Document#valid? validates the resulting AIXM or OFMX against its XML schema. If any, you find the errors in AIXM::Document#errors.


By using AIXM::Refinements you get a few handy extensions to Ruby core classes.



The mkmid executable reads an OFMX file, adds OFMX-compliant mid values into all *Uid elements and validates the result against the schema.

mkmid --help


The chmid executable reads an OFMX file, validates it against the schema and checks all mid attributes for OFMX-compliance.

ckmid --help





Some tests are very time consuming and therefore skipped by default. To run the full test suite, set the environment variable:

export SPEC_SCOPE=all


To install the development dependencies and then run the test suite:

bundle install
bundle exec rake    # run tests once
bundle exec guard   # run tests whenever files are modified

Please submit issues on:

To contribute code, fork the project on Github, add your code and submit a pull request:

