Documentation ¶
Overview ¶
Package gpx implements a simple GPX parser.
Index ¶
- func ElevationAngle(loc1, loc2 *Wpt, radians bool) float64
- type Bounds
- type Copyright
- type Email
- type Gpx
- func (g *Gpx) Bounds() *Bounds
- func (g *Gpx) Clone() *Gpx
- func (g *Gpx) Duration() float64
- func (g *Gpx) Length2D() float64
- func (g *Gpx) Length3D() float64
- func (g *Gpx) LocationAt(t time.Time) []Wpt
- func (g *Gpx) MovingData() *MovingData
- func (g *Gpx) Split(trackNo, segNo, pointNo int)
- func (g *Gpx) TimeBounds() (start, end time.Time)
- func (g *Gpx) ToXML() []byte
- func (g *Gpx) UphillDownhill() (uphill, downhill float64)
- type Link
- type Metadata
- type MovingData
- type Person
- type Rte
- type Trk
- func (trk *Trk) Bounds() *Bounds
- func (trk *Trk) Duration() float64
- func (trk *Trk) Join(segNo, segNo2 int)
- func (trk *Trk) JoinNext(segNo int)
- func (trk *Trk) Length2D() float64
- func (trk *Trk) Length3D() float64
- func (trk *Trk) LocationAt(t time.Time) []Wpt
- func (trk *Trk) MovingData() *MovingData
- func (trk *Trk) Split(segNo, ptNo int)
- func (trk *Trk) TimeBounds() (start, end time.Time)
- func (trk *Trk) UphillDownhill() (uphill, downhill float64)
- type Trkseg
- type Waypoints
- func (w Waypoints) Bounds() *Bounds
- func (w Waypoints) Center() (lat, lon float64)
- func (w Waypoints) Duration() float64
- func (w Waypoints) Elevations() []float64
- func (w Waypoints) Length2D() float64
- func (w Waypoints) Length3D() float64
- func (w Waypoints) LocationAt(t time.Time) int
- func (w Waypoints) MovingData() *MovingData
- func (w Waypoints) Speed(pointIdx int) float64
- func (w Waypoints) TimeBounds() (start, end time.Time)
- func (w Waypoints) UphillDownhill() (uphill, downhill float64)
- type Wpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ElevationAngle ¶
ElevationAngle calculates the elavation angle
Types ¶
type Bounds ¶
type Bounds struct { XMLName xml.Name `xml:"bounds"` MinLat float64 `xml:"minlat,attr"` MaxLat float64 `xml:"maxlat,attr"` MinLon float64 `xml:"minlon,attr"` MaxLon float64 `xml:"maxlon,attr"` }
Bounds is a GPX bounds tag
type Copyright ¶
type Copyright struct { XMLName xml.Name `xml:"copyright"` Author string `xml:"author,attr"` Year string `xml:"year,omitempty"` License string `xml:"license,omitempty"` }
Copyright is a GPX copyright tag
type Email ¶
type Email struct { XMLName xml.Name `xml:"email"` ID string `xml:"id,attr,omitempty"` Domain string `xml:"domain,attr,omitempty"` }
Email is a GPX email tag
type Gpx ¶
type Gpx struct { XMLName xml.Name `xml:"gpx"` XMLNs string `xml:"xmlns,attr"` XMLNsXsi string `xml:"xmlns:xsi,attr,omitempty"` XMLSchemaLoc string `xml:"xsi:schemaLocation,attr,omitempty"` Version string `xml:"version,attr"` Creator string `xml:"creator,attr"` Metadata *Metadata `xml:"metadata,omitempty"` Waypoints Waypoints `xml:"wpt,omitempty"` Routes []Rte `xml:"rte,omitempty"` Tracks []Trk `xml:"trk"` }
Gpx represents the root of a GPX file
func (*Gpx) LocationAt ¶
LocationAt returns a slice of Wpts for a certain time.
func (*Gpx) MovingData ¶
func (g *Gpx) MovingData() *MovingData
MovingData returns the moving data for all tracks in a Gpx.
func (*Gpx) TimeBounds ¶
TimeBounds returns the time bounds of all tacks in a Gpx.
func (*Gpx) UphillDownhill ¶
UphillDownhill returns uphill and downhill values for all tracks in a Gpx.
type Link ¶
type Link struct { XMLName xml.Name `xml:"link"` URL string `xml:"href,attr,omitempty"` Text string `xml:"text,omitempty"` Type string `xml:"type,omitempty"` }
Link is a GPX link
type Metadata ¶
type Metadata struct { XMLName xml.Name `xml:"metadata"` Name string `xml:"name,omitempty"` Desc string `xml:"desc,omitempty"` Author *Person `xml:"author,omitempty"` Copyright *Copyright `xml:"copyright,omitempty"` Links []Link `xml:"link,omitempty"` Timestamp string `xml:"time,omitempty"` Keywords string `xml:"keywords,omitempty"` Bounds *Bounds `xml:"bounds"` }
Metadata is a GPX metadata tag
type MovingData ¶
type MovingData struct { MovingTime float64 StoppedTime float64 MovingDistance float64 StoppedDistance float64 MaxSpeed float64 }
MovingData represents moving data
type Person ¶
type Person struct { XMLName xml.Name `xml:"author"` Name string `xml:"name,omitempty"` Email *Email `xml:"email,omitempty"` Link *Link `xml:"link,omitempty"` }
Person is a GPX person tag
type Rte ¶
type Rte struct { XMLName xml.Name `xml:"rte"` Name string `xml:"name,omitempty"` Cmt string `xml:"cmt,omitempty"` Desc string `xml:"desc,omitempty"` Src string `xml:"src,omitempty"` Links []Link `xml:"link"` Number int `xml:"number,omitempty"` Type string `xml:"type,omitempty"` Waypoints `xml:"rtept"` }
Rte is a GPX Route
type Trk ¶
type Trk struct { XMLName xml.Name `xml:"trk"` Name string `xml:"name,omitempty"` Cmt string `xml:"cmt,omitempty"` Desc string `xml:"desc,omitempty"` Src string `xml:"src,omitempty"` Links []Link `xml:"link"` Number int `xml:"number,omitempty"` Type string `xml:"type,omitempty"` Segments []Trkseg `xml:"trkseg"` }
Trk is a GPX track
func (*Trk) LocationAt ¶
LocationAt returns a slice of Wpt for a given time.
func (*Trk) MovingData ¶
func (trk *Trk) MovingData() *MovingData
MovingData returns the moving data of a GPX track.
func (*Trk) TimeBounds ¶
TimeBounds returns the time bounds of a GPX track.
func (*Trk) UphillDownhill ¶
UphillDownhill return the uphill and downhill values of a GPX track.
type Waypoints ¶
type Waypoints []Wpt
Waypoints is a collection of waypoints whether in a track, a route, or standalone.
func (Waypoints) Elevations ¶
Elevations returns a slice with the elevations in a GPX segment.
func (Waypoints) LocationAt ¶
LocationAt returns the Wpt at a given time.
func (Waypoints) MovingData ¶
func (w Waypoints) MovingData() *MovingData
MovingData returns the moving data of a GPX segment.
func (Waypoints) TimeBounds ¶
TimeBounds returns the time bounds of a GPX segment.
func (Waypoints) UphillDownhill ¶
UphillDownhill returns uphill and dowhill in a GPX segment.
type Wpt ¶
type Wpt struct { Lat float64 `xml:"lat,attr"` Lon float64 `xml:"lon,attr"` // Position info Ele float64 `xml:"ele,omitempty"` Timestamp string `xml:"time,omitempty"` MagVar string `xml:"magvar,omitempty"` GeoIDHeight string `xml:"geoidheight,omitempty"` // Description info Name string `xml:"name,omitempty"` Cmt string `xml:"cmt,omitempty"` Desc string `xml:"desc,omitempty"` Src string `xml:"src,omitempty"` Links []Link `xml:"link"` Sym string `xml:"sym,omitempty"` Type string `xml:"type,omitempty"` // Accuracy info Fix string `xml:"fix,omitempty"` Sat int `xml:"sat,omitempty"` Hdop float64 `xml:"hdop,omitempty"` Vdop float64 `xml:"vdop,omitempty"` Pdop float64 `xml:"pdop,omitempty"` AgeOfGpsData float64 `xml:"ageofgpsdata,omitempty"` DGpsID int `xml:"dgpsid,omitempty"` }
Wpt is a GPX waypoint
func (*Wpt) Distance2D ¶
Distance2D returns the 2D distance of two GpxWpts.
func (*Wpt) Distance3D ¶
Distance3D returns the 3D distance of two GpxWpts.
func (*Wpt) MaxDilutionOfPrecision ¶
MaxDilutionOfPrecision returns the dilution precision of a GpxWpt.
func (*Wpt) SpeedBetween ¶
SpeedBetween calculates the speed between two GpxWpts.