gps 0.3.1 → 0.4.0
raw patch · 2 files changed
+20/−1 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.GPS: divideArea :: Distance -> Distance -> DMSCoordinate -> DMSCoordinate -> [[DMSCoordinate]]
- Data.GPS: east :: Double
+ Data.GPS: east :: Heading
- Data.GPS: north :: Integer
+ Data.GPS: north :: Heading
- Data.GPS: south :: Double
+ Data.GPS: south :: Heading
- Data.GPS: west :: Double
+ Data.GPS: west :: Heading
Files
- Data/GPS.hs +19/−0
- gps.cabal +1/−1
Data/GPS.hs view
@@ -44,6 +44,7 @@ , dmsToRadianPair , degreePairToDMS , addVector+ , divideArea ) where import Data.Ord (comparing)@@ -143,15 +144,19 @@ radiusOfEarth = 6378700 -- |North is 0 radians+north :: Heading north = 0 -- |South, being 180 degrees from North, is pi.+south :: Heading south = pi -- |East is 270 degrees from North+east :: Heading east = (3 / 2) * pi -- |West is 90 degrees (pi/2)+west :: Heading west = pi / 2 toDecimal = (*) (180 / pi)@@ -277,6 +282,20 @@ -- O( (n * m) * log (n * m) ) closestDistance :: Coordinate a => Trail a -> Trail a -> Maybe Distance closestDistance as bs = listToMaybe $ sort [distance a b | a <- as, b <- bs]+++-- |@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 :: Distance -> Distance -> DMSCoordinate -> DMSCoordinate -> [[DMSCoordinate]]+divideArea vDist hDist nw se =+ let (top,left) = dmsToDegreePair nw+ (btm,right) = dmsToDegreePair se+ columnOne = takeWhile ( (<= west) . heading se) . iterate (addVector (vDist, south)) $ nw+ buildRow = takeWhile ((>= north) . heading se) . iterate (addVector (hDist, east))+ in map buildRow columnOne instance Pretty DMSCoordinate where pPrint c =
gps.cabal view
@@ -1,5 +1,5 @@ name: gps-version: 0.3.1+version: 0.4.0 license: BSD3 license-file: LICENSE author: Thomas DuBuisson <thomas.dubuisson@gmail.com>