[](https://rubygems.org/gems/aixm)
[](https://travis-ci.org/svoop/aixm)
[](https://codeclimate.com/github/svoop/aixm)
[](https://gitter.im/svoop/aixm)
[](https://donorbox.org/bitcetera-aixm)
# AIXM
Partial implementation of the [Aeronautical Information Exchange Model (AIXM 4.5)](http://aixm.aero)
for Ruby.
For now, only the parts needed to automize the AIP import of [Open Flightmaps](https://openflightmaps.org)
are part of this gem. Most notably, the gem is only a builder of AIXM 4.5
snapshot files and does not parse them.
* [Homepage](https://github.com/svoop/aixm)
* Author: [Sven Schwyn - Bitcetera](http://www.bitcetera.com)
## Install
Add this to your Gemfile:
```ruby
gem aixm
```
## Usage
### Types
#### Coordinate
All of the below are equivalent:
```ruby
AIXM::XY.new(lat: %q(11°22'33.44"), long: %q(-111°22'33.44"))
AIXM::XY.new(lat: '112233.44N', long: '1112233.44W')
AIXM::XY.new(lat: 11.375955555555556, long: -111.37595555555555)
```
#### Altitude
```ruby
AIXM::Z.new(alt: 1000, code: :QFE) # height: 1000ft above ground
AIXM::Z.new(alt: 2000, code: :QNH) # altitude: of 2000ft above mean sea level
AIXM::Z.new(alt: 45, code: :QNE) # altitude: flight level 45
```
### Document
See spec/factory.rb for examples.
## Rendering
```ruby
document.to_xml # render AIXM 4.5 compliant XML
document.to_xml(:OFM) # render AIXM 4.5 + OFM extensions XML
```
## Constants
* AIXM::GROUND - height: 0ft above ground
## Refinements
By `using AIXM::Refinements` you get the following general purpose methods:
* String#indent(number)
Indent every line of a string with *number* spaces
* String#to_dd
Convert DMS angle to DD or nil if the format is not recognized
* Float#to_dms(padding)
Convert DD angle to DMS with the degrees zero padded to *padding* length
* Float#trim
Convert whole numbers to Integer and leave all other untouched
## References
* [AIXM](http://aixm.aero)
* [AIXM on Wikipedia](https://en.wikipedia.org/wiki/AIXM)
* [Open Flightmaps](https://openflightmaps.org)
## 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](http://opensource.org/licenses/MIT).