parse cadence
This commit is contained in:
parent
94a8987828
commit
a85a00762d
@ -11,6 +11,7 @@ type alias Point =
|
|||||||
{ loc : Position
|
{ loc : Position
|
||||||
, time : Maybe Time.Posix
|
, time : Maybe Time.Posix
|
||||||
, power : Maybe Int
|
, power : Maybe Int
|
||||||
|
, cadence : Maybe Int
|
||||||
}
|
}
|
||||||
|
|
||||||
type alias Track = List Point
|
type alias Track = List Point
|
||||||
@ -25,11 +26,12 @@ timeDecoder = XD.andThen (\ts ->
|
|||||||
|
|
||||||
triple x y z = (x,y,z)
|
triple x y z = (x,y,z)
|
||||||
|
|
||||||
pointDecoder = XD.map3 Point
|
pointDecoder = XD.map4 Point
|
||||||
(XD.map3 triple (floatAttr "lat") (floatAttr "lon")
|
(XD.map3 triple (floatAttr "lat") (floatAttr "lon")
|
||||||
(XD.maybe (path ["ele"] (single XD.float))))
|
(XD.maybe (path ["ele"] (single XD.float))))
|
||||||
(XD.maybe (path ["time"] (single timeDecoder)))
|
(XD.maybe (path ["time"] (single timeDecoder)))
|
||||||
(XD.maybe (path ["extensions", "gpxtpx:TrackPointExtension", "pwr:PowerInWatts"] (single XD.int)))
|
(XD.maybe (path ["extensions", "gpxtpx:TrackPointExtension", "pwr:PowerInWatts"] (single XD.int)))
|
||||||
|
(XD.maybe (path ["extensions", "gpxtpx:TrackPointExtension", "gpxtpx:cad"] (single XD.int)))
|
||||||
|
|
||||||
|
|
||||||
gpxDecoder =
|
gpxDecoder =
|
||||||
|
@ -69,13 +69,18 @@ threepoints_expected =
|
|||||||
(51.600643, -0.01856, Just 64.8)
|
(51.600643, -0.01856, Just 64.8)
|
||||||
(Just (Time.millisToPosix 1729669252256))
|
(Just (Time.millisToPosix 1729669252256))
|
||||||
(Just 89)
|
(Just 89)
|
||||||
|
(Just 110)
|
||||||
)
|
)
|
||||||
, (Point
|
, (Point
|
||||||
(51.600679, -0.018179, Just 65.5)
|
(51.600679, -0.018179, Just 65.5)
|
||||||
(Just (Time.millisToPosix 1729669255259))
|
(Just (Time.millisToPosix 1729669255259))
|
||||||
(Just 86))
|
(Just 86)
|
||||||
|
(Just 111)
|
||||||
|
)
|
||||||
, (Point
|
, (Point
|
||||||
(51.600697, -0.018064, Just 66.2)
|
(51.600697, -0.018064, Just 66.2)
|
||||||
(Just (Time.millisToPosix 1729669256231))
|
(Just (Time.millisToPosix 1729669256231))
|
||||||
(Just 86))
|
(Just 86)
|
||||||
|
(Just 111)
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user