souplesse/src/Track.elm

23 lines
459 B
Elm
Raw Normal View History

2024-10-23 22:37:29 +00:00
module Track exposing (Track, parse)
import Result
import Xml.Decode as XD exposing (path, single, list, float)
type alias Point =
{ lat : Float
, lon : Float
}
type alias Track = List Point
pointDecoder = XD.map2 Point
(XD.path ["ele"] (single float))
(XD.path ["ele"] (single float))
gpxDecoder =
(XD.path [ "trk", "trkseg", "trkpt" ] (XD.list pointDecoder))
parse str = XD.run gpxDecoder str