rust-gpx
gpx is a library for reading and writing GPX (GPS Exchange Format) files. It uses the
primitives provided by rust-geo to allow for storage
of GPS data.
Example
extern crate gpx;
use std::io::BufReader;
use std::fs::File;
use gpx::read;
use gpx::{Gpx, Track, Waypoint};
fn main() {
let file = File::open("tests/fixtures/wikipedia_example.gpx").unwrap();
let reader = BufReader::new(file);
let gpx: Gpx = read(reader).unwrap();
let track: &Track = &gpx.tracks[0];
assert_eq!(track.name, Some(String::from("Example GPX Document")));
let segment: &TrackSegment = &track.segments[0];
assert_eq!(segment.points[0].elevation, Some(4.46));
assert_eq!(segment.points[1].elevation, Some(4.94));
assert_eq!(segment.points[2].elevation, Some(6.87));
}
Contributing
All contributions are welcome! Please open an issue if you find a bug / have any
questions, and pull requests are always appreciated.
License
rust-gpx is licensed under the MIT license.