gem to read a gpx file
ATTENTION: this version works but is still under (slow) development
Add this line to your application's Gemfile:
gem 'gpx_reader'
And then execute:
$ bundle
Or install it yourself as:
$ gem install gpx_reader
gpx_reader accept a file as argument or a string.
To read a gpx file just call @gpx = GPXReader::Gpx.new(file) or @gpx = GPXReader::Gpx.new(string)
Then use it as follow:
- @gpx.creator => creator of the file
- @gpx.time => Time of creation
- @gpx.tracks => array of track
- for the track inside @gpx.tracks
- track.name
- track.desc
- track.segments
- ...
The distance is calculated based on the haversine method ( http://en.wikipedia.org/wiki/Haversine_formula) and implementation of the algorithm is based on the following source: http://www.movable-type.co.uk/scripts/latlong.html
This gem has been written for my own needs, if you feel something is missing don't hesitate to ask
- list all the points directly from the track
- calculate boundaries of the tracks/segments unless in the metadata
- calculate elapsed time
- write more tests
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request