Skip to content

Commit

Permalink
Updated *GPX with MovingData with DistancesAndSpeed
Browse files Browse the repository at this point in the history
  • Loading branch information
mbecker committed Nov 7, 2018
1 parent 7d93494 commit a34a0fa
Show file tree
Hide file tree
Showing 7 changed files with 47,092 additions and 26 deletions.
14 changes: 8 additions & 6 deletions gpx/gpx.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,24 +217,26 @@ func (g *GPX) MovingData() MovingData {
stoppedDistance float64
maxSpeed float64
)

var speedsAndDistances map[int]SpeedsAndDistances
for _, trk := range g.Tracks {
md := trk.MovingData()
movingTime += md.MovingTime
stoppedTime += md.StoppedTime
movingDistance += md.MovingDistance
stoppedDistance += md.StoppedDistance
speedsAndDistances = md.DistancesAndSpeeds

if md.MaxSpeed > maxSpeed {
maxSpeed = md.MaxSpeed
}
}
return MovingData{
MovingTime: movingTime,
MovingDistance: movingDistance,
StoppedTime: stoppedTime,
StoppedDistance: stoppedDistance,
MaxSpeed: maxSpeed,
MovingTime: movingTime,
MovingDistance: movingDistance,
StoppedTime: stoppedTime,
StoppedDistance: stoppedDistance,
MaxSpeed: maxSpeed,
DistancesAndSpeeds: speedsAndDistances,
}
}

Expand Down
Loading

0 comments on commit a34a0fa

Please sign in to comment.