map-dots/traccar/generic.go

24 lines
551 B
Go
Raw Permalink Normal View History

2023-08-11 18:56:41 +01:00
package traccar
import "git.fjla.uk/fred.boniface/map-dots/data"
func MapToPositionData(positions []Positions) []data.LocationData {
var locationDataList []data.LocationData
for _, pos := range positions {
speedInMph := int(pos.Speed * 1.15078)
// Unsure of the accuracy of the speed data
locationData := data.LocationData{
Latitude: pos.Latitude,
Longitude: pos.Longitude,
Speed: uint32(speedInMph),
Altitude: pos.Altitude,
}
locationDataList = append(locationDataList, locationData)
}
return locationDataList
}