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
- type Distance = Double
- type Heading = Double
- type Speed = Double
- type Vector = (Distance, Heading)
- type Trail a = [a]
- north :: Heading
- south :: Heading
- east :: Heading
- west :: Heading
- radiusOfEarth :: Double
- heading :: (Lat a, Lon a, Lat b, Lon b) => a -> b -> Heading
- distance :: (Lat a, Lon a, Lat b, Lon b) => a -> b -> Distance
- speed :: (Lat loc, Lon loc, Time loc, Lat b, Lon b, Time b) => loc -> b -> Maybe Speed
- addVector :: (Lat c, Lon c) => Vector -> c -> c
- getRadianPair :: (Lat p, Lon p) => p -> (LatitudeType, LongitudeType)
- getDMSPair :: (Lat c, Lon c) => c -> (LatitudeType, LongitudeType)
- divideArea :: (Lat c, Lon c) => Distance -> Distance -> c -> c -> [[c]]
- totalDistance :: (Lat a, Lon a) => [a] -> Distance
- restLocations :: (Lat a, Lon a, Time a) => Distance -> NominalDiffTime -> Trail a -> [Trail a]
- closestDistance :: (Lat a, Lon a) => Trail a -> Trail a -> Maybe Distance
- filterByMaxSpeed :: (Lat loc, Lon loc, Time loc) => Speed -> Trail loc -> Trail loc
- convexHull :: (Eq c, Lat c, Lon c) => [c] -> [c]
- readGPX :: FilePath -> IO (Trail WptType)
- module Data.Geo.GPX
Angles are expressed in radians from North. 0 == North pi/2 == West pi == South (32)pi == East == - (pi 2)
Direction two points aim toward (0 = North, pi2 = West, pi = South, 3pi2 = East)
Speed in meters per second, only if a
Time was recorded for each waypoint.
Given a vector and coordinate, computes a new coordinate. Within some epsilon it should hold that if
dest = addVector (dist,heading) start
heading == dmsHeading start dest
dist == distance start dest
Provides a lat/lon pair of doubles in radians
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).
Creates a list of trails all of which are within the given distance of each other spanning atleast the given amount of time.
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.
Returns the closest distance between two trails (or Nothing if a trail is empty) O( (n * m) * log (n * m) )
Filter out all points that result in a speed greater than a given value (the second point is dropped)
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.