-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | For manipulating GPS coordinates and trails. -- -- Useful for manipulating GPS coordinages (in various forms), building -- paths, and performing basic computations @package gps @version 0.6 -- | A basic GPS library with calculations for distance and speed along -- with helper functions for filtering/smoothing trails. All distances -- are in meters and time is in seconds. Speed is thus meters/second module Data.GPS -- | Distances are expressed in meters type Distance = Double -- | Angles are expressed in radians from North. 0 == North pi/2 == West pi -- == South (32)pi == East == - (pi 2) type Heading = Double -- | Speed is hard coded as meters per second type Speed = Double type Vector = (Distance, Heading) type Trail a = [a] -- | North is 0 radians north :: Heading -- | South, being 180 degrees from North, is pi. south :: Heading -- | East is 270 degrees from North east :: Heading -- | West is 90 degrees (pi/2) west :: Heading -- | radius of the earth in meters radiusOfEarth :: Double -- | Direction two points aim toward (0 = North, pi2 = West, pi = South, -- 3pi2 = East) heading :: (Lat a, Lon a) => a -> a -> Heading distance :: (Lat a, Lon a) => a -> a -> Distance -- | Speed in meters per second, only if a Time was recorded for -- each waypoint. speed :: (Lat loc, Lon loc, Time loc) => loc -> loc -> Maybe Speed -- | Given a vector and coordinate, computes a new coordinate. Within some -- epsilon it should hold that if -- --
-- dest = addVector (dist,heading) start ---- -- then -- --
-- heading == dmsHeading start dest ---- --
-- dist == distance start dest --addVector :: (Lat c, Lon c) => Vector -> c -> c -- | Provides a lat/lon pair of doubles in radians getRadianPair :: (Lat p, Lon p) => p -> (LatitudeType, LongitudeType) getDMSPair :: (Lat c, Lon c) => c -> (LatitudeType, LongitudeType) -- | divideArea vDist hDist nw se divides an area into a grid of -- equally spaced coordinates within the box drawn by the northwest point -- (nw) and southeast point (se). Because this uses floating point there -- might be a different number of points in some rows (the last might be -- too far east based on a heading from the se point). divideArea :: (Lat c, Lon c) => Distance -> Distance -> c -> c -> [[c]] -- | Find the total distance traveled totalDistance :: (Lat a, Lon a) => [a] -> Distance -- | Creates a list of trails all of which are within the given distance of -- each other spanning atleast the given amount of time. -- -- For example restLocations 50 600 would return lists of all -- points that are within 50 meters of each other and span at least 10 -- minutes (600 seconds). -- -- Note this gives points within fifty meters of the earliest point - -- wandering in a rest area with a 50 meter radius could result in -- several rest points ([a,b..]) or even none if the distance between -- individual points exceeds 50m. restLocations :: (Lat a, Lon a, Time a) => Distance -> NominalDiffTime -> Trail a -> [Trail a] -- | Returns the closest distance between two trails (or Nothing if a trail -- is empty) O( (n * m) * log (n * m) ) closestDistance :: (Lat a, Lon a) => Trail a -> Trail a -> Maybe Distance -- | Filter out all points that result in a speed greater than a given -- value (the second point is dropped) filterByMaxSpeed :: (Lat loc, Lon loc, Time loc) => Speed -> Trail loc -> Trail loc -- | Uses Grahams scan to compute the convex hull of the given points. This -- operation requires sorting of the points, so don't try it unless you -- have notably more memory than the list of points will consume. convexHull :: (Eq c, Lat c, Lon c) => [c] -> [c] -- | Reads a GPX file (using the GPX library) by simply concatenating all -- the tracks, segments, and points (trkpts, trksegs, -- trks) into a single Trail. readGPX :: FilePath -> IO (Trail WptType) instance Eq Turn instance Ord Turn instance Show Turn instance Read Turn instance Enum Turn