geodetics-0.1.2: Terrestrial coordinate systems and geodetic calculations.

Safe HaskellNone
LanguageHaskell2010

Geodetics.Geodetic

Contents

Synopsis

Geodetic Coordinates

data Geodetic e Source #

Defines a three-D position on or around the Earth using latitude, longitude and altitude with respect to a specified ellipsoid, with positive directions being North and East. The default "show" instance gives position in degrees, minutes and seconds to 5 decimal places, which is a resolution of about 1m on the Earth's surface. Internally latitude and longitude are stored as double precision radians. Convert to degrees using e.g. latitude g /~ degree.

The functions here deal with altitude by assuming that the local height datum is always co-incident with the ellipsoid in use, even though the "mean sea level" (the usual height datum) can be tens of meters above or below the ellipsoid, and two ellipsoids can differ by similar amounts. This is because the altitude is usually known with reference to a local datum regardless of the ellipsoid in use, so it is simpler to preserve the altitude across all operations. However if you are working with ECEF coordinates from some other source then this may give you the wrong results, depending on the altitude correction your source has used.

There is no Eq instance because comparing two arbitrary co-ordinates on the Earth is a non-trivial exercise. Clearly if all the parameters are equal on the same ellipsoid then they are indeed in the same place. However if different ellipsoids are used then two co-ordinates with different numbers can still refer to the same physical location. If you want to find out if two co-ordinates are the same to within a given tolerance then use "geometricDistance" (or its squared variant to avoid an extra sqrt operation).

Constructors

Geodetic 
Instances
Ellipsoid e => Show (Geodetic e) Source # 
Instance details

Defined in Geodetics.Geodetic

Methods

showsPrec :: Int -> Geodetic e -> ShowS #

show :: Geodetic e -> String #

showList :: [Geodetic e] -> ShowS #

Ellipsoid e => HasAltitude (Geodetic e) Source # 
Instance details

Defined in Geodetics.Geodetic

readGroundPosition :: Ellipsoid e => e -> String -> Maybe (Geodetic e) Source #

Read the latitude and longitude of a ground position and return a Geodetic position on the specified ellipsoid.

The latitude and longitude may be in any of the following formats. The comma between latitude and longitude is optional in all cases. Latitude must always be first.

  • Signed decimal degrees: 34.52327, -46.23234
  • Decimal degrees NSEW: 34.52327N, 46.23234W
  • Degrees and decimal minutes (units optional): 34° 31.43' N, 46° 13.92'
  • Degrees, minutes and seconds (units optional): 34° 31' 23.52" N, 46° 13' 56.43" W
  • DDDMMSS format with optional leading zeros: 343123.52N, 0461356.43W

toLocal :: (Ellipsoid e1, Ellipsoid e2) => e2 -> Geodetic e1 -> Geodetic e2 Source #

Convert a position from any geodetic to another one, assuming local altitude stays constant.

toWGS84 :: Ellipsoid e => Geodetic e -> Geodetic WGS84 Source #

Convert a position from any geodetic to WGS84, assuming local altitude stays constant.

antipode :: Ellipsoid e => Geodetic e -> Geodetic e Source #

The point on the Earth diametrically opposite the argument, with the same altitude.

geometricalDistance :: Ellipsoid e => Geodetic e -> Geodetic e -> Length Double Source #

The absolute distance in a straight line between two geodetic points. They must be on the same ellipsoid. Note that this is not the geodetic distance taken by following the curvature of the earth.

geometricalDistanceSq :: Ellipsoid e => Geodetic e -> Geodetic e -> Area Double Source #

The square of the absolute distance. Comes out as Area type of course.

groundDistance :: Ellipsoid e => Geodetic e -> Geodetic e -> Maybe (Length Double, Dimensionless Double, Dimensionless Double) Source #

The shortest ellipsoidal distance between two points on the ground with reference to the same ellipsoid. Altitude is ignored.

The results are the distance between the points, the bearing of the second point from the first, and (180 degrees - the bearing of the first point from the second).

The algorithm can fail to converge where the arguments are near to antipodal. In this case it returns Nothing.

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

properAngle :: Angle Double -> Angle Double Source #

Add or subtract multiples of 2*pi so that for all t, -pi < properAngle t < pi.

showAngle :: Angle Double -> String Source #

Show an angle as degrees, minutes and seconds to two decimal places.

Earth Centred Earth Fixed Coordinates

type ECEF = Vec3 (Length Double) Source #

Earth-centred, Earth-fixed coordinates as a vector. The origin and axes are not defined: use with caution.

geoToEarth :: Ellipsoid e => Geodetic e -> ECEF Source #

Convert a geodetic coordinate into earth centered, relative to the ellipsoid in use.

earthToGeo :: Ellipsoid e => e -> ECEF -> (Angle Double, Angle Double, Length Double) Source #

Convert an earth centred coordinate into a geodetic coordinate on the specified geoid.

Uses the closed form solution of H. Vermeille: Direct transformation from geocentric coordinates to geodetic coordinates. Journal of Geodesy Volume 76, Number 8 (2002), 451-454

Re-exported for convenience

data WGS84 Source #

The WGS84 geoid, major radius 6378137.0 meters, flattening = 1 / 298.257223563 as defined in "Technical Manual DMA TM 8358.1 - Datums, Ellipsoids, Grids, and Grid Reference Systems" at the National Geospatial-Intelligence Agency (NGA).

The WGS84 has a special place in this library as the standard Ellipsoid against which all others are defined.

Constructors

WGS84 
Instances
Eq WGS84 Source # 
Instance details

Defined in Geodetics.Ellipsoids

Methods

(==) :: WGS84 -> WGS84 -> Bool #

(/=) :: WGS84 -> WGS84 -> Bool #

Show WGS84 Source # 
Instance details

Defined in Geodetics.Ellipsoids

Methods

showsPrec :: Int -> WGS84 -> ShowS #

show :: WGS84 -> String #

showList :: [WGS84] -> ShowS #

Ellipsoid WGS84 Source # 
Instance details

Defined in Geodetics.Ellipsoids