geodetics 0.0.2 → 0.0.3
raw patch · 9 files changed
+30/−25 lines, 9 filesdep ~basePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base
API changes (from Hackage documentation)
Files
- README.md +6/−3
- geodetics.cabal +5/−5
- src/Geodetics/Altitude.hs +2/−2
- src/Geodetics/Ellipsoids.hs +1/−1
- src/Geodetics/Geodetic.hs +1/−1
- src/Geodetics/Path.hs +6/−5
- src/Geodetics/Stereographic.hs +2/−2
- src/Geodetics/TransverseMercator.hs +3/−3
- test/Main.hs +4/−3
README.md view
@@ -7,8 +7,8 @@ specified Terrestrial Reference Frame (TRF). The basic TRF is the WGS84, which is the one used by GPS and Google Earth. Others can be added by describing the underlying ellipsoid and the difference in angle and centre with WGS84, and a position in one TRF can be-transformed into another. Given two points in the same TRF you can find the shortest distance between them-and the bearing from one to the other.+transformed into another. Given two points in the same TRF you can find the shortest distance +between them and the bearing from one to the other. Once you have a geodetic position defined you can project it onto a flat plane, or Grid. At present Transverse Mercator and Oblique Stereographic grids are provided. More can be@@ -22,4 +22,7 @@ Release Notes ------------- -Verison 0.0.2: Tided up cabal file and removed spurious dependency on Parsec.+Version 0.0.2: Tided up cabal file and removed spurious dependency on Parsec.++Version 0.0.3: Updated for Haskell Platform 2014.2.0.0 and GHC 7.8.3. Fixed+ some minor documentation issues.
geodetics.cabal view
@@ -1,5 +1,5 @@ name: geodetics-version: 0.0.2+version: 0.0.3 cabal-version: >= 1.10 build-type: Simple author: Paul Johnson <paul@cogito.org.uk>@@ -9,8 +9,8 @@ README.md, ToDo.txt license: BSD3-copyright: Paul Johnson 2014.-synopsis: Terrestrial coordinate systems and associated calculations.+copyright: Paul Johnson 2015.+synopsis: Terrestrial coordinate systems and geodetic calculations. description: Precise geographical coordinates (latitude & longitude), with conversion between different reference frames and projections. .@@ -21,7 +21,7 @@ maintainer: Paul Johnson <paul@cogito.org.uk> homepage: https://github.com/PaulJohnson/geodetics category: Geography-tested-with: GHC==7.6.3+tested-with: GHC==7.8.3 source-repository head type: git@@ -30,7 +30,7 @@ library hs-source-dirs: src build-depends: - base >= 4.6 && < 4.7,+ base >= 4.6 && < 4.8, dimensional == 0.13.*, array >= 0.4 ghc-options: -Wall
src/Geodetics/Altitude.hs view
@@ -3,9 +3,9 @@ ) where import Numeric.Units.Dimensional.Prelude-import qualified Prelude as P --- | All geographical coordinate systems need the concept of altitude above a reference point, usually associated with+-- | All geographical coordinate systems need the concept of#+-- altitude above a reference point, usually associated with -- local sea level. -- -- Minimum definition: altitude, setAltitude.
src/Geodetics/Ellipsoids.hs view
@@ -42,7 +42,7 @@ import Data.Monoid import Numeric.Units.Dimensional import Numeric.Units.Dimensional.Prelude-import qualified Prelude as P+import Prelude () -- Numeric instances. -- | 3d vector as @(X,Y,Z)@.
src/Geodetics/Geodetic.hs view
@@ -227,7 +227,7 @@ -- Uses Vincenty's formula. \"Direct and inverse solutions of -- geodesics on the ellipsoid with application of nested -- equations\". T. Vincenty. Survey Review XXII 176, April--- 1975. http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf+-- 1975. <http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf> groundDistance :: (Ellipsoid e) => Geodetic e -> Geodetic e -> Maybe (Length Double, Dimensionless Double, Dimensionless Double) groundDistance p1 p2 = do
src/Geodetics/Path.hs view
@@ -6,7 +6,7 @@ import Geodetics.Ellipsoids import Geodetics.Geodetic import Numeric.Units.Dimensional.Prelude-import qualified Prelude as P+import Prelude () -- | Lower and upper exclusive bounds within which a path is valid. @@ -137,7 +137,7 @@ in (if c `dot3` norm < _0 then negate else id) $ atan2 (mag3 c) (v1 `dot3` v2) r = majorRadius $ ellipsoid pt1 -{- Note on derivation+{- Note on derivation of "intersect" The algorithm is a variant of the Newton-Raphson method, and shares its advantage of rapid convergence in many useful cases. Each path has a current approximation to@@ -148,10 +148,10 @@ The Great Circle calculations use a vector method rather than spherical trigonometry. This avoids a lot of transcendental functions and also the singularities inherent in polar coordinate systems. This implementation is based on formulae from -http://www.movable-type.co.uk/scripts/latlong-vectors.html, which in turn is based on +<http://www.movable-type.co.uk/scripts/latlong-vectors.html>, which in turn is based on "A Non-singular Horizontal Position Representation" by Kenneth Gade, THE JOURNAL OF NAVIGATION (2010), 63, 395–417.-http://www.navlab.net/Publications/A_Nonsingular_Horizontal_Position_Representation.pdf+<http://www.navlab.net/Publications/A_Nonsingular_Horizontal_Position_Representation.pdf> "pt1" is the current approximation for the result on "path1". The vector "nv1" is the @@ -206,7 +206,8 @@ -- | Rhumb line: path following a constant course. Also known as a loxodrome. -- -- The valid range stops a few arc-minutes short of the poles to ensure that the --- polar singularities are not included.+-- polar singularities are not included. Anyone using a rhumb line that close to a pole+-- must be going round the twist anyway. -- -- Based on *Practical Sailing Formulas for Rhumb-Line Tracks on an Oblate Earth* -- by G.H. Kaplan, U.S. Naval Observatory. Except for points close to the poles
src/Geodetics/Stereographic.hs view
@@ -1,7 +1,7 @@ {- | The following is based on equations in Section 1.4.7.1 in OGP Surveying and Positioning Guidance Note number 7, part 2 – August 2006- http://ftp.stu.edu.tw/BSD/NetBSD/pkgsrc/distfiles/epsg-6.11/G7-2.pdf+<http://ftp.stu.edu.tw/BSD/NetBSD/pkgsrc/distfiles/epsg-6.11/G7-2.pdf> -} {-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}@@ -15,7 +15,7 @@ import Geodetics.Geodetic import Geodetics.Grid import Numeric.Units.Dimensional.Prelude-import qualified Prelude as P+import Prelude () -- | A stereographic projection with its origin at an arbitrary point on Earth, other than the poles.
src/Geodetics/TransverseMercator.hs view
@@ -11,7 +11,7 @@ import Geodetics.Geodetic import Geodetics.Grid import Numeric.Units.Dimensional.Prelude-import qualified Prelude as P+import Prelude () -- | A Transverse Mercator projection gives an approximate mapping of the ellipsoid on to a 2-D grid. It models -- a sheet curved around the ellipsoid so that it touches it at one north-south line (hence making it part of@@ -83,7 +83,7 @@ where- GridPoint east' north' _ _ = (falseOrigin grid) `applyOffset` p+ GridPoint east' north' _ _ = falseOrigin grid `applyOffset` p lat' = fst $ head $ dropWhile ((> 0.01 *~ milli meter) . snd) $ tail $ iterate next (latitude $ trueOrigin grid, 1 *~ meter) where@@ -104,7 +104,7 @@ grid = gridBasis p toGrid grid geo = applyOffset (off `mappend` (offsetNegate $ falseOrigin grid)) $ - GridPoint (0 *~ metre) (0 *~ metre) (0 *~ metre) grid+ GridPoint _0 _0 _0 grid where v = aF0 / sqrt (_1 - e2 * sinLat2) rho = aF0 * (_1 - e2) * (_1 - e2 * sinLat2) ** ((-1.5) *~ one)
test/Main.hs view
@@ -115,7 +115,7 @@ -- | Sample pairs of points with bearings and distances. -- The Oracle for these values is the @FORWARD@ program from--- http://www.ngs.noaa.gov/TOOLS/Inv_Fwd/Inv_Fwd.html+-- <http://www.ngs.noaa.gov/TOOLS/Inv_Fwd/Inv_Fwd.html> worldLines :: [(String, Geodetic WGS84, Geodetic WGS84, Length Double, Dimensionless Double, Dimensionless Double)] worldLines = [ ("Ordinary", Geodetic (40*~degree) (30*~degree) _0 WGS84, Geodetic (30*~degree) (50*~degree) _0 WGS84,@@ -136,7 +136,7 @@ && abs (b - b1) < 0.01 *~ arcsecond -- | Sample points for UK tests. The oracle for these values is the script at --- http://www.movable-type.co.uk/scripts/latlong-convert-coords.html, which uses+-- <http://www.movable-type.co.uk/scripts/latlong-convert-coords.html>, which uses -- the same Helmert transform as this library. Hence the results should match to within 30 cm. ukPoints :: [(String, Geodetic WGS84, Geodetic OSGB36)] ukPoints = [@@ -270,7 +270,8 @@ origin = GridOffset ((-155000) *~ metre) (463000 *~ metre) (0 *~ meter) --- | Data for the stereographic tests taken from http://ftp.stu.edu.tw/BSD/NetBSD/pkgsrc/distfiles/epsg-6.11/G7-2.pdf+-- | Data for the stereographic tests taken from +-- <http://ftp.stu.edu.tw/BSD/NetBSD/pkgsrc/distfiles/epsg-6.11/G7-2.pdf> stereographicToGridN :: Bool stereographicToGridN = sameGrid g1 g1' where