packages feed

chorale-geo 0.1.0 → 0.1.1

raw patch · 2 files changed

+16/−5 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Chorale.Geo.Coordinates: transformWGS84toCartesian :: Double -> CoordinatesWGS84 -> CoordinatesCartesian

Files

chorale-geo.cabal view
@@ -1,5 +1,5 @@ name:           chorale-geo-version:        0.1.0+version:        0.1.1 homepage:       https://github.com/mocnik-science/chorale-geo bug-reports:    https://github.com/mocnik-science/chorale-geo/issues synopsis:       A module containing basic geo functions
src/Chorale/Geo/Coordinates.hs view
@@ -22,7 +22,9 @@     -- * Coordinates     Coordinates(..),     CoordinatesCartesian(..),-    CoordinatesWGS84(..)) where+    CoordinatesWGS84(..),+    -- * Coordinate Transformations+    transformWGS84toCartesian) where  import Chorale.Common @@ -59,12 +61,11 @@   distance :: c -> c -> Double   azimuth :: c -> c -> Double +-- --== COORDINATES CARTESIAN+ -- | Cartesian coordinates newtype CoordinatesCartesian = CoordinatesCartesian (Double, Double) deriving (Ord, Eq, Show, Generic) --- | Geographic coordinates (WGS84)-newtype CoordinatesWGS84 = CoordinatesWGS84 (Double, Double) deriving (Ord, Eq, Show, Generic)- instance B.Binary CoordinatesCartesian  instance Coordinates CoordinatesCartesian where@@ -82,6 +83,11 @@     distance = curry $ uncurry distance . map12 CoordinatesCartesian     azimuth = curry $ uncurry azimuth . map12 CoordinatesCartesian +-- --== COORDINATES WGS84++-- | Geographic coordinates (WGS84)+newtype CoordinatesWGS84 = CoordinatesWGS84 (Double, Double) deriving (Ord, Eq, Show, Generic)+ instance B.Binary CoordinatesWGS84  instance Coordinates CoordinatesWGS84 where@@ -118,3 +124,8 @@                     cos2sm = sqrt cos2a - 2 * sin u1 * sin u2 / cos2a                     c = f / 16 * cos2a * (4 + f * (4 - 3 * cos2a))                     x' = l + (1 - c) * f * sina * (s + c * sins * (cos2sm + c * coss * (-1 + 2 * cos2sm**2)))++-- --== COORDINATE TRANSFORMATIONS++transformWGS84toCartesian :: Double -> CoordinatesWGS84 -> CoordinatesCartesian+transformWGS84toCartesian k (CoordinatesWGS84 (lon, lat)) = CoordinatesCartesian (128 / pi * 2**k * (degreeToRad lon + pi), 128 / pi * 2**k * (pi - log (tan (pi / 4 + degreeToRad lat / 2))))