GPX parsing library for the Go language which also support all Garmin extensions #gpx #gpx-library #go #golang
GPX is an XML schema defined as a common data format for software applications. You can find more about it on Wikipedia. The schema itself can be found here.
As of v1.1 (released on Aug 9, 2004), each GPX file has the following:
- wptType (WayPoint) which lists each individual waypoint
- rteType (Route) is a list of points leading to a waypoint which suggests where a person should or might go
- trkType (Track) is a list of points which explains the path that the person took
- extensions to handle data which isn't part of the main spec
The Garmin extension spec details how to handle the data for Waypoint, Route, RoutePoint, Track and TrackPoint Extensions
It can handle the following
- Metadata
- Bounds
- WayPoints
- Routes
- TrackSegments
- TrackPoints
- PointSegments
- Point
- Latitude
- Longitude
- Degrees
- Fix
- DGPSStation
- Copyright
- Person
- Link
It can handle the following from the Garmin Extension spec
- Waypoint Extensions
- Route Extensions
- RoutePoint Extensions
- Track Extensions
- TrackPoint Extensions
You can install it into your project using
dep ensure -add github.com/sudhanshuraheja/go-garmin-gpx
If you would like to run the automated tests for the complete package, run this
make coverage
open ./coverage.html
We use the default golang coding conventions. Run the following to test for those
make fmt
make vet
make lint
file := "./samples/mapbox.gpx"
g, err := gpx.ParseFile(file)
if err != nil {
return err
}
fmt.Println(g.Metadata.Timestamp)
You can find some samples of GPX files in the /samples
folder
- Avoid reading the complete file into memory
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
This project is licensed under the Apache License 2.0 - see the LICENSE file for details