| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Flight.Kml.Internal
Synopsis
- showLatLngAlt :: (Latitude, Longitude, Altitude) -> String
- showLngLatAlt :: (Latitude, Longitude, Altitude) -> String
- showTimeAlt :: Fix -> String
- fixesLength :: MarkedFixes -> Int
- fixesSecondsRange :: MarkedFixes -> Maybe (Seconds, Seconds)
- fixesUTCTimeRange :: MarkedFixes -> Maybe (UTCTime, UTCTime)
- showFixesLength :: MarkedFixes -> String
- showFixesSecondsRange :: MarkedFixes -> String
- showFixesUTCTimeRange :: MarkedFixes -> String
- formatFloat :: String -> String
- roundTripLatLngAlt :: (Latitude, Longitude, Altitude) -> (Double, Double, Altitude)
- parseTimeOffsets :: String -> [Seconds]
- parseBaroMarks :: String -> [Altitude]
- parseLngLatAlt :: String -> [LLA]
- parseUtcTime :: String -> Maybe UTCTime
Internal Usage
Working with the KML tracklog dump from the tracklog file "Phil de Joux.20120114-082221.21437.40.kml".
>>>Right mf@(MarkedFixes{mark0, fixes}) <- parse kml>>>mark02012-01-14 02:12:55 UTC>>>length fixes6547>>>head fixesFix {fixMark = 0s, fix = LLA {llaLat = -33.36160000°, llaLng = 147.93205000°, llaAltGps = 237m}, fixAltBaro = Just 239m}>>>last fixesFix {fixMark = 13103s, fix = LLA {llaLat = -33.65073300°, llaLng = 147.56036700°, llaAltGps = 214m}, fixAltBaro = Just 238m}
The length and range of the tracklog.
>>>fixesLength mf6547>>>fixesSecondsRange mfJust (0s,13103s)>>>fixesUTCTimeRange mfJust (2012-01-14 02:12:55 UTC,2012-01-14 05:51:18 UTC)
Showing the fixes in the tracklog.
>>>showFixesLength mf"6547">>>showFixesSecondsRange mf"(0s,13103s)">>>showFixesUTCTimeRange mf"(2012-01-14 02:12:55 UTC,2012-01-14 05:51:18 UTC)"
Showing a single fix.
>>>let a = head fixes>>>let z = last fixes>>>let lla = (lat . fix $ a, lng . fix $ a, altGps . fix $ a)>>>showLatLngAlt lla"-33.361600,147.932050,237">>>showLngLatAlt lla"147.932050,-33.361600,237">>>showTimeAlt a"(0s,237m)">>>showTimeAlt z"(13103s,214m)"
Display of a fix
showLatLngAlt :: (Latitude, Longitude, Altitude) -> String Source #
Shows lat,lng,alt.
>>>showLatLngAlt (Latitude (-33.65073300), Longitude 147.56036700, Altitude 214)"-33.650733,147.560367,214"
showLngLatAlt :: (Latitude, Longitude, Altitude) -> String Source #
Shows lng,lat,alt.
>>>showLngLatAlt (Latitude (-33.65073300), Longitude 147.56036700, Altitude 214)"147.560367,-33.650733,214"
showTimeAlt :: Fix -> String Source #
Shows relative time offset in seconds and altitude in metres.
>>>import Flight.Kml (mkPosition)>>>let lla = mkPosition (Latitude (-33.65073300), Longitude 147.56036700, Altitude 214)>>>showTimeAlt $ Fix (Seconds 0) lla Nothing"(0s,214m)"
Length and range
fixesLength :: MarkedFixes -> Int Source #
The number of fixes in the track log. There is a fixesLength example in the usage section.
fixesSecondsRange :: MarkedFixes -> Maybe (Seconds, Seconds) Source #
In the given list of fixes, the seconds offset of the first and last elements. There is a fixesSecondsRange example in the usage section.
fixesUTCTimeRange :: MarkedFixes -> Maybe (UTCTime, UTCTime) Source #
In the given list of fixes, the UTC time of the first and last elements. There is a fixesUTCTimeRange example in the usage section.
Display of fixes
showFixesLength :: MarkedFixes -> String Source #
Shows the number of elements in the list of fixes, in the tracklog. There is a showFixesLength example in the usage section.
showFixesSecondsRange :: MarkedFixes -> String Source #
Shows the relative time range of the tracklog. There is a showFixesSecondsRange example in the usage section.
showFixesUTCTimeRange :: MarkedFixes -> String Source #
Shows the absolute time range of the tracklog. There is a showFixesUTCTimeRange example in the usage section.
Parsing
formatFloat :: String -> String Source #
Avoids "0." because ...
> (read "0." :: Double) Exception: Prelude.read: no parse > (read "0.0" :: Double) 0.0
>>>formatFloat "112.2334455""112.233446">>>formatFloat "0""0.000000">>>formatFloat "0.""0.000000">>>formatFloat "0.0""0.000000"
roundTripLatLngAlt :: (Latitude, Longitude, Altitude) -> (Double, Double, Altitude) Source #
Round trip from rational to double and back to rational.
>>>roundTripLatLngAlt (Latitude (-33.65073300), Longitude 147.56036700, Altitude 214)(-33.650733,147.560367,214m)
parseTimeOffsets :: String -> [Seconds] Source #
Parse the list of time offsets.
>>>parseTimeOffsets "0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30"[0s,2s,4s,6s,8s,10s,12s,14s,16s,18s,20s,22s,24s,26s,28s,30s]
parseBaroMarks :: String -> [Altitude] Source #
Parse the list of barometric pressure altitudes.
>>>parseBaroMarks "239 240 240 239 239 239 239 239 239 240 239 240 239 239 240"[239m,240m,240m,239m,239m,239m,239m,239m,239m,240m,239m,240m,239m,239m,240m]
parseLngLatAlt :: String -> [LLA] Source #
Parse comma-separated triples of lng,lat,alt, each triple separated by spaces.
>>>parseLngLatAlt "147.932050,-33.361600,237 147.932050,-33.361600,238"[LLA {llaLat = -33.36160000°, llaLng = 147.93205000°, llaAltGps = 237m},LLA {llaLat = -33.36160000°, llaLng = 147.93205000°, llaAltGps = 238m}]