Copyright | © 2018 Phil de Joux © 2018 Block Scope Limited |
---|---|
License | MPL-2.0 |
Maintainer | Phil de Joux <phil.dejoux@blockscope.com> |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newtype Seconds = Seconds Integer
- newtype Latitude = Latitude Rational
- newtype Longitude = Longitude Rational
- newtype Altitude = Altitude Integer
- class LatLngAlt a where
- class LatLngAlt a => FixMark a where
- data LLA = LLA {}
- mkPosition :: (Latitude, Longitude, Altitude) -> LLA
- data Fix = Fix {}
- data MarkedFixes = MarkedFixes {}
- parse :: String -> IO (Either String MarkedFixes)
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
>>>
mark0
2012-01-14 02:12:55 UTC>>>
length fixes
6547>>>
head fixes
Fix {fixMark = 0s, fix = LLA {llaLat = -33.36160000°, llaLng = 147.93205000°, llaAltGps = 237m}, fixAltBaro = Just 239m}>>>
last fixes
Fix {fixMark = 13103s, fix = LLA {llaLat = -33.65073300°, llaLng = 147.56036700°, llaAltGps = 214m}, fixAltBaro = Just 238m}
The newtypes
The number of seconds offset from the time of the first fix.
Instances
Eq Seconds Source # | |
Num Seconds Source # | |
Ord Seconds Source # | |
Show Seconds Source # | |
Generic Seconds Source # | |
ToJSON Seconds Source # | |
Defined in Flight.Types | |
FromJSON Seconds Source # | |
DefaultDecimalPlaces Seconds Source # | |
Defined in Flight.Types defdp :: Seconds -> DecimalPlaces # | |
type Rep Seconds Source # | |
Defined in Flight.Types |
Latitude in degress.
Instances
Eq Latitude Source # | |
Show Latitude Source # | |
Generic Latitude Source # | |
ToJSON Latitude Source # | |
Defined in Flight.Types | |
FromJSON Latitude Source # | |
DefaultDecimalPlaces Latitude Source # | |
Defined in Flight.Types defdp :: Latitude -> DecimalPlaces # | |
type Rep Latitude Source # | |
Defined in Flight.Types |
Longitude in degress.
Instances
Eq Longitude Source # | |
Show Longitude Source # | |
Generic Longitude Source # | |
ToJSON Longitude Source # | |
Defined in Flight.Types | |
FromJSON Longitude Source # | |
DefaultDecimalPlaces Longitude Source # | |
Defined in Flight.Types defdp :: Longitude -> DecimalPlaces # | |
type Rep Longitude Source # | |
Defined in Flight.Types |
Altitude in metres.
Instances
Eq Altitude Source # | |
Num Altitude Source # | |
Ord Altitude Source # | |
Defined in Flight.Types | |
Show Altitude Source # | |
Generic Altitude Source # | |
ToJSON Altitude Source # | |
Defined in Flight.Types | |
FromJSON Altitude Source # | |
DefaultDecimalPlaces Altitude Source # | |
Defined in Flight.Types defdp :: Altitude -> DecimalPlaces # | |
type Rep Altitude Source # | |
Defined in Flight.Types |
Typeclasses
class LatLngAlt a => FixMark a where Source #
Class for a tracklog relative fix, offset in seconds, with an optional barometric pressure altitude.
Tracklog as a list of marked fixes
Latitude, longitude and GPS altitude. Use mkPosition
to construct a LLA
.
Instances
Eq LLA Source # | |
Show LLA Source # | |
Generic LLA Source # | |
ToJSON LLA Source # | |
Defined in Flight.Types | |
FromJSON LLA Source # | |
LatLngAlt LLA Source # | |
type Rep LLA Source # | |
Defined in Flight.Types type Rep LLA = D1 (MetaData "LLA" "Flight.Types" "flight-kml-1.0.0-EmlCX9TRxkFGW009dRTfgq" False) (C1 (MetaCons "LLA" PrefixI True) (S1 (MetaSel (Just "llaLat") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Latitude) :*: (S1 (MetaSel (Just "llaLng") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Longitude) :*: S1 (MetaSel (Just "llaAltGps") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Altitude)))) |
mkPosition :: (Latitude, Longitude, Altitude) -> LLA Source #
Constructs a LLA
from its parts.
>>>
mkPosition (Latitude (-33.65073300), Longitude 147.56036700, Altitude 214)
LLA {llaLat = -33.65073300°, llaLng = 147.56036700°, llaAltGps = 214m}
Latitude, longitude and GPS altitude with a relative time offset in seconds and possibly a barometric pressure altitude.
Instances
Eq Fix Source # | |
Show Fix Source # | |
Generic Fix Source # | |
ToJSON Fix Source # | |
Defined in Flight.Types | |
FromJSON Fix Source # | |
FixMark Fix Source # | |
LatLngAlt Fix Source # | |
type Rep Fix Source # | |
Defined in Flight.Types type Rep Fix = D1 (MetaData "Fix" "Flight.Types" "flight-kml-1.0.0-EmlCX9TRxkFGW009dRTfgq" False) (C1 (MetaCons "Fix" PrefixI True) (S1 (MetaSel (Just "fixMark") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Seconds) :*: (S1 (MetaSel (Just "fix") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 LLA) :*: S1 (MetaSel (Just "fixAltBaro") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Maybe Altitude))))) |
data MarkedFixes Source #
A tracklog is a list of fixes along with the UTC time of the first fix.
Instances
Parsing
parse :: String -> IO (Either String MarkedFixes) Source #
Parse the tracklog from the KML string as MarkedFixes
.
>>>
Right MarkedFixes{mark0, fixes} <- parse kml
>>>
mark0
2012-01-14 02:12:55 UTC>>>
length fixes
6547>>>
head fixes
Fix {fixMark = 0s, fix = LLA {llaLat = -33.36160000°, llaLng = 147.93205000°, llaAltGps = 237m}, fixAltBaro = Just 239m}>>>
last fixes
Fix {fixMark = 13103s, fix = LLA {llaLat = -33.65073300°, llaLng = 147.56036700°, llaAltGps = 214m}, fixAltBaro = Just 238m}
GPSDump KML
Here's an example of a tracklog dump from the last day of the Hang Gliding Pre-Worlds Forbes 2012. The flight instrument is a Flytec 6030. The pilot with CIVL ID 21437 is me, the author of this package, Phil de Joux.
<?xml version="1.0" encoding="UTF-8"?> <Document> <open>1</open> <Folder> <Metadata src="GpsDump" v="4.66" type="trip"/> <open>1</open> <name>Trip</name> <description><![CDATA[Tracklog from GpsDump competition mode <pre> Flight statistics Date 2012-01-14 Start/finish 02:12:55 - 05:51:18 Duration 3 : 38 : 23 Max.min. height 2392 214 m Max. meantop speed 72 kmh 82 kmh Maxmin climb rate 4.35 -4.23 m/s over 60s Total distance 166.89 km </pre>]]> </description> ... <Placemark> <Metadata src="GpsDump" v="4.66" type="track"> <FsInfo time_of_first_point="2012-01-14T02:12:55Z" civl_pilot_id="21437" comp_pilot_id="40" instrument="6030 SN06451 SW3.30" downloaded="2012-01-14T08:22:21Z" hash="61168B84FE0DAC55F3D65EFBA888B08F72834DDF"> <SecondsFromTimeOfFirstPoint> 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 ... 13061 13063 13065 13067 13069 13071 13073 13075 13077 13079 13081 13083 13085 13087 13089 13091 13093 13095 13097 13099 13101 13103 </SecondsFromTimeOfFirstPoint> <PressureAltitude> 239 240 240 239 239 239 239 239 239 240 239 240 239 239 240 239 240 240 240 240 239 239 240 240 240 ... 237 237 237 237 237 237 237 238 238 237 238 237 237 238 237 237 238 238 237 238 237 238 </PressureAltitude> </FsInfo> </Metadata> <name>Tracklog</name> <LineString> <altitudeMode>absolute</altitudeMode> <coordinates> 147.932050,-33.361600,237 147.932050,-33.361600,238 147.932050,-33.361600,238 147.932050,-33.361600,238 147.932067,-33.361600,238 ... 147.560367,-33.650733,215 147.560367,-33.650733,215 147.560367,-33.650733,214 147.560367,-33.650733,214 147.560367,-33.650733,214 147.560367,-33.650733,214 147.560367,-33.650733,214 </coordinates> </LineString> </Placemark> </Folder> </Document>