Version Tests Code Climate Donorbox

AIXM

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.

Install

Add this to your Gemfile or gems.rb:

gem aixm

Usage

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

document = AIXM.document
document.features << AIXM.designated_point(
  id: "ABIXI",
  xy: AIXM.xy(lat: %q(46°31'54.3"N), long: %q(002°19'55.2"W)),
  type: :icao
)
document.aixm!   # not really necessary since AIXM is the default schema
document.to_xml

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

AIXM::Feature::NavigationalAid::DesignatedPoint.new(...)
AIXM.designated_point(...)

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

Configuration

AIXM.config.schema

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

AIXM.config.mid_region

In order to insert OFMX-compliant mid attributes for all *Uid elements, set this configuration option to the OFMX region the element belongs to. By default, no mid attributes are inserted.

AIXM.config.mid_region          # => nil  - don't insert any mid attributes
AIXM.config.mid_region = 'LF'   # => 'LF' - insert mid attributes for region LF

AIXM.config.ignored_errors

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

Validation

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

Model

Fundamentals

Features

Components

Refinements

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

References

AIXM

OFMX

Tests

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

Development

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:

https://github.com/svoop/aixm/issues

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

https://help.github.com/articles/fork-a-repo

License

The gem is available as open source under the terms of the MIT License.