coordinate 0.1.1 → 0.1.2
raw patch · 7 files changed
+217/−12 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Data.Geodetic.Ellipsoid: airy1830 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: ans :: Ellipsoid
+ Data.Geodetic.Ellipsoid: au1965 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: bessel1841 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: clarke1858 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: clarke1866 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: clarke1880 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: everest1830 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: grs67 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: grs80 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: hayford1909 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: international1924 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: krasovsky1940 :: Ellipsoid
+ Data.Geodetic.Ellipsoid: wgs72 :: Ellipsoid
+ Data.Geodetic.LL: (<◦>) :: Double -> Double -> LL
+ Data.Geodetic.LL: degrees :: Iso' (Double, Double) LL
+ Data.Geodetic.Sphere: Sphere :: Double -> Sphere
+ Data.Geodetic.Sphere: earthMean :: Sphere
+ Data.Geodetic.Sphere: ellipsoidSphere :: Prism' Ellipsoid Sphere
+ Data.Geodetic.Sphere: instance Control.Lens.Wrapped.Wrapped Data.Geodetic.Sphere.Sphere
+ Data.Geodetic.Sphere: instance Data.Geodetic.Sphere.Sphere ~ t0 => Control.Lens.Wrapped.Rewrapped Data.Geodetic.Sphere.Sphere t0
+ Data.Geodetic.Sphere: instance GHC.Classes.Eq Data.Geodetic.Sphere.Sphere
+ Data.Geodetic.Sphere: instance GHC.Classes.Ord Data.Geodetic.Sphere.Sphere
+ Data.Geodetic.Sphere: instance GHC.Show.Show Data.Geodetic.Sphere.Sphere
+ Data.Geodetic.Sphere: newtype Sphere
- Data.Geodetic.ECEF: class HasECEF c_ae3F where xy = (.) eCEF xy z = (.) eCEF z
+ Data.Geodetic.ECEF: class HasECEF c_ajBp where xy = (.) eCEF xy z = (.) eCEF z
- Data.Geodetic.ECEF: eCEF :: HasECEF c_ae3F => Lens' c_ae3F ECEF
+ Data.Geodetic.ECEF: eCEF :: HasECEF c_ajBp => Lens' c_ajBp ECEF
- Data.Geodetic.ECEF: xy :: HasECEF c_ae3F => Lens' c_ae3F XY
+ Data.Geodetic.ECEF: xy :: HasECEF c_ajBp => Lens' c_ajBp XY
- Data.Geodetic.ECEF: z :: HasECEF c_ae3F => Lens' c_ae3F Double
+ Data.Geodetic.ECEF: z :: HasECEF c_ajBp => Lens' c_ajBp Double
- Data.Geodetic.Ellipsoid: class HasEllipsoid c_ad0s where flattening = (.) ellipsoid flattening semiMajor = (.) ellipsoid semiMajor
+ Data.Geodetic.Ellipsoid: class HasEllipsoid c_aevt where flattening = (.) ellipsoid flattening semiMajor = (.) ellipsoid semiMajor
- Data.Geodetic.Ellipsoid: ellipsoid :: HasEllipsoid c_ad0s => Lens' c_ad0s Ellipsoid
+ Data.Geodetic.Ellipsoid: ellipsoid :: HasEllipsoid c_aevt => Lens' c_aevt Ellipsoid
- Data.Geodetic.Ellipsoid: flattening :: HasEllipsoid c_ad0s => Lens' c_ad0s Double
+ Data.Geodetic.Ellipsoid: flattening :: HasEllipsoid c_aevt => Lens' c_aevt Double
- Data.Geodetic.Ellipsoid: semiMajor :: HasEllipsoid c_ad0s => Lens' c_ad0s Double
+ Data.Geodetic.Ellipsoid: semiMajor :: HasEllipsoid c_aevt => Lens' c_aevt Double
- Data.Geodetic.LL: class HasLL c_aaz6 where lat = (.) lL lat lon = (.) lL lon
+ Data.Geodetic.LL: class HasLL c_ab2z where lat = (.) lL lat lon = (.) lL lon
- Data.Geodetic.LL: lL :: HasLL c_aaz6 => Lens' c_aaz6 LL
+ Data.Geodetic.LL: lL :: HasLL c_ab2z => Lens' c_ab2z LL
- Data.Geodetic.LL: lat :: HasLL c_aaz6 => Lens' c_aaz6 Double
+ Data.Geodetic.LL: lat :: HasLL c_ab2z => Lens' c_ab2z Double
- Data.Geodetic.LL: lon :: HasLL c_aaz6 => Lens' c_aaz6 Double
+ Data.Geodetic.LL: lon :: HasLL c_ab2z => Lens' c_ab2z Double
- Data.Geodetic.LLH: class HasLLH c_abnz where height = (.) lLH height
+ Data.Geodetic.LLH: class HasLLH c_acTq where height = (.) lLH height
- Data.Geodetic.LLH: height :: HasLLH c_abnz => Lens' c_abnz Double
+ Data.Geodetic.LLH: height :: HasLLH c_acTq => Lens' c_acTq Double
- Data.Geodetic.LLH: lLH :: HasLLH c_abnz => Lens' c_abnz LLH
+ Data.Geodetic.LLH: lLH :: HasLLH c_acTq => Lens' c_acTq LLH
- Data.Geodetic.XY: class HasXY c_accg where x = (.) xY x y = (.) xY y
+ Data.Geodetic.XY: class HasXY c_adHD where x = (.) xY x y = (.) xY y
- Data.Geodetic.XY: x :: HasXY c_accg => Lens' c_accg Double
+ Data.Geodetic.XY: x :: HasXY c_adHD => Lens' c_adHD Double
- Data.Geodetic.XY: xY :: HasXY c_accg => Lens' c_accg XY
+ Data.Geodetic.XY: xY :: HasXY c_adHD => Lens' c_adHD XY
- Data.Geodetic.XY: y :: HasXY c_accg => Lens' c_accg Double
+ Data.Geodetic.XY: y :: HasXY c_adHD => Lens' c_adHD Double
Files
- changelog.md +7/−1
- coordinate.cabal +2/−1
- src/Data/Geodetic.hs +1/−0
- src/Data/Geodetic/Ellipsoid.hs +112/−0
- src/Data/Geodetic/LL.hs +40/−6
- src/Data/Geodetic/LLH.hs +0/−4
- src/Data/Geodetic/Sphere.hs +55/−0
changelog.md view
@@ -1,10 +1,16 @@+0.1.2++* Functions to construct using degrees.+* Added `Sphere` data type.+* More ellipsoids.+ 0.1.1 * Explicit export lists. 0.1.0 -* A rewrite using `ECEF`, `XY, `LLH`, `LL` data types.+* A rewrite using `ECEF`, `XY`, `LLH`, `LL` data types. 0.0.21
coordinate.cabal view
@@ -1,5 +1,5 @@ name: coordinate-version: 0.1.1+version: 0.1.2 license: BSD3 license-file: LICENCE author: Tony Morris <ʇǝu˙sıɹɹoɯʇ@ןןǝʞsɐɥ>@@ -50,6 +50,7 @@ Data.Geodetic.HasDoubles Data.Geodetic.LLH Data.Geodetic.LL+ Data.Geodetic.Sphere Data.Geodetic.XY test-suite doctests
src/Data/Geodetic.hs view
@@ -10,4 +10,5 @@ import Data.Geodetic.HasDoubles as G import Data.Geodetic.LLH as G import Data.Geodetic.LL as G+import Data.Geodetic.Sphere as G import Data.Geodetic.XY as G
src/Data/Geodetic/Ellipsoid.hs view
@@ -5,7 +5,22 @@ Ellipsoid(..) , HasEllipsoid(..) , flatteningReciprocal+-- * Ellipsoids , wgs84+, grs80+, grs67+, ans+, wgs72+, au1965+, krasovsky1940+, international1924+, hayford1909+, airy1830+, everest1830+, bessel1841+, clarke1858+, clarke1866+, clarke1880 ) where import Control.Applicative(Applicative((<*>)))@@ -45,3 +60,100 @@ Ellipsoid 6378137 298.257223563++grs80 ::+ Ellipsoid+grs80 =+ Ellipsoid+ 6378137+ 298.257222101++grs67 ::+ Ellipsoid+grs67 =+ Ellipsoid+ 6378160+ 298.25++ans ::+ Ellipsoid+ans =+ Ellipsoid+ 6378160+ 298.25++wgs72 ::+ Ellipsoid+wgs72 =+ Ellipsoid+ 6378135+ 298.26++au1965 ::+ Ellipsoid+au1965 =+ Ellipsoid+ 6378160+ 298.25++krasovsky1940 ::+ Ellipsoid+krasovsky1940 =+ Ellipsoid+ 6378245+ 298.3++international1924 ::+ Ellipsoid+international1924 =+ Ellipsoid+ 6378388+ 297++hayford1909 ::+ Ellipsoid+hayford1909 =+ international1924++airy1830 ::+ Ellipsoid+airy1830 =+ Ellipsoid+ 6377563.4+ 299.32++everest1830 ::+ Ellipsoid+everest1830 =+ Ellipsoid+ 6377276.3+ 300.8++bessel1841 ::+ Ellipsoid+bessel1841 =+ Ellipsoid+ 6377397.2+ 299.15++clarke1858 ::+ Ellipsoid+clarke1858 =+ Ellipsoid+ 6378293.645+ 294.26++clarke1866 ::+ Ellipsoid+clarke1866 =+ Ellipsoid+ 6378206.4+ 294.98++clarke1880 ::+ Ellipsoid+clarke1880 =+ Ellipsoid+ 6378249.145+ 293.465+
src/Data/Geodetic/LL.hs view
@@ -1,23 +1,24 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE FunctionalDependencies #-} module Data.Geodetic.LL( LL(..) , HasLL(..)+, degrees+, (<◦>) ) where import Control.Applicative(Applicative((<*>)))-import Control.Lens(makeClassy)+import Control.Lens(makeClassy, Iso', iso, (^.)) import Data.Eq(Eq) import Data.Functor((<$>)) import Data.Geodetic.HasDoubles(HasDoubles(doubles)) import Data.Ord(Ord)-import Prelude(Show, Double)+import Prelude(Fractional((/)), Show, Double, pi, Num((*))) +-- $setup+-- >>> import Control.Lens+ data LL = LL { _lat ::@@ -34,3 +35,36 @@ LL <$> f a <*> f o++-- |+--+-- >>> ((27.34, 152.15) ^. degrees)+-- LL {_lat = 0.47717301749524965, _lon = 2.6555184569093724}+--+-- >>> (degrees # LL 0.47717 2.65552)+-- (27.33982711025749,152.15008841258037)+degrees ::+ Iso'+ (Double, Double)+ LL+degrees =+ iso + (\(t, n) -> let r a = a / 180 * pi+ in LL (r t) (r n))+ (\(LL t n) -> let r a = a / pi * 180+ in (r t, r n))++-- |+--+-- >>> 27.34 <◦> 152.15+-- LL {_lat = 0.47717301749524965, _lon = 2.6555184569093724}+--+-- >>> 61.94 <◦> (-152.15)+-- LL {_lat = 1.0810569386852877, _lon = -2.6555184569093724}+(<◦>) ::+ Double+ -> Double+ -> LL+t <◦> n =+ (t, n) ^. degrees+
src/Data/Geodetic/LLH.hs view
@@ -1,9 +1,5 @@ {-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE FunctionalDependencies #-} module Data.Geodetic.LLH( LLH(..)
+ src/Data/Geodetic/Sphere.hs view
@@ -0,0 +1,55 @@+{-# LANGUAGE NoImplicitPrelude #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}++module Data.Geodetic.Sphere(+ Sphere(..)+, earthMean+, ellipsoidSphere+) where++import Control.Lens(makeWrapped, Prism', prism')+import Data.Eq(Eq((==)))+import Data.Maybe(Maybe(Just, Nothing))+import Data.Ord(Ord)+import Data.Geodetic.Ellipsoid(Ellipsoid(Ellipsoid))+import Prelude(Double, Show)++-- $setup+-- >>> import Control.Lens++newtype Sphere =+ Sphere Double+ deriving (Eq, Ord, Show)++makeWrapped ''Sphere++-- |+--+-- >>> earthMean+-- Sphere 6367450.0+earthMean ::+ Sphere+earthMean =+ Sphere 6367450++-- |+--+-- >>> ellipsoidSphere # Sphere 77+-- Ellipsoid {_semiMajor = 77.0, _flattening = 1.0}+--+-- >>> Ellipsoid 77 1 ^? ellipsoidSphere+-- Just (Sphere 77.0)+--+-- >>> Ellipsoid 77 2 ^? ellipsoidSphere+-- Nothing+ellipsoidSphere ::+ Prism'+ Ellipsoid+ Sphere+ellipsoidSphere = + prism'+ (\(Sphere s) -> Ellipsoid s 1)+ (\(Ellipsoid m f) -> if f == 1 then Just (Sphere m) else Nothing)