Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GPX ¶
type GPX struct { XMLName xml.Name `xml:"gpx"` Metadata Metadata `xml:"metadata"` Routes []Route `xml:"rte"` Tracks []Track `xml:"trk"` }
GPX is the main structure for GPX files
func FromFile ¶
FromFile reads the contents of the supplied filepath and returns a structure of type GPX in case of success
type Metadata ¶
type Metadata struct { XMLName xml.Name `xml:"metadata"` Name string `xml:"name"` Time string `xml:"time"` Description string `xml:"desc"` }
Metadata contains some metadata from the GPX file
type Route ¶
type Route struct { XMLName xml.Name `xml:"rte"` Name string `xml:"name"` Description string `xml:"desc"` RouteWaypoints []RouteWaypoint `xml:"rtept"` }
Route contains details for a GPX route
type RouteWaypoint ¶
type RouteWaypoint struct { XMLName xml.Name `xml:"rtept"` Latitude float64 `xml:"lat,attr"` Longitude float64 `xml:"lon,attr"` Name string `xml:"name"` Description string `xml:"desc"` Elevation float64 `xml:"ele"` }
RouteWaypoint contains details for a GPX route waypoint
type Track ¶
type Track struct { XMLName xml.Name `xml:"trk"` Name string `xml:"name"` Segments []TrackSegment `xml:"trkseg"` }
Track contains details for a GPX track
func (Track) CalcTotalDistance ¶
CalcTotalDistance calculates the distance of a GPX track in meters, also considering the elevation provided in the GPX file.
func (Track) CalcTotalDuration ¶
CalcTotalDuration calculates the amount of time you will need for this route, based on the time data provided in the track data of the GPX file this will return the duration in seconds
type TrackPoint ¶
type TrackPoint struct { XMLName xml.Name `xml:"trkpt"` Latitude float64 `xml:"lat,attr"` Longitude float64 `xml:"lon,attr"` Elevation float64 `xml:"ele"` Time string `xml:"time"` }
TrackPoint contains details for a GPX trackpoint
type TrackSegment ¶
type TrackSegment struct { XMLName xml.Name `xml:"trkseg"` Points []TrackPoint `xml:"trkpt"` }
TrackSegment contain details for a GPX track segment