jord-0.6.0.0: Geographical Position Calculations

Copyright(c) 2018 Cedric Liegeois
LicenseBSD3
MaintainerCedric Liegeois <ofmooseandmen@yahoo.fr>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Geo.Jord.Angle

Contents

Description

Types and functions for working with angles representing latitudes, longitude and bearings.

Synopsis

The Angle type

data Angle Source #

An angle with a resolution of a milliseconds of a degree. When used as a latitude/longitude this roughly translate to a precision of 30 millimetres at the equator.

Instances
Eq Angle Source # 
Instance details

Defined in Data.Geo.Jord.Angle

Methods

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

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

Read Angle Source #

See readAngle.

Instance details

Defined in Data.Geo.Jord.Angle

Show Angle Source #

Angle is shown degrees, minutes, seconds and milliseconds - e.g. 154°25'43.5".

Instance details

Defined in Data.Geo.Jord.Angle

Methods

showsPrec :: Int -> Angle -> ShowS #

show :: Angle -> String #

showList :: [Angle] -> ShowS #

Quantity Angle Source #

Add/Subtract Angles.

Instance details

Defined in Data.Geo.Jord.Angle

NTransform a => IsGreatCircle (a, Angle) Source #

GreatCircle passing by the given position and heading on given bearing.

    greatCircle (readLatLong "283321N0290700W", decimalDegrees 33.0)
Instance details

Defined in Data.Geo.Jord.Geodetics

Smart constructors

decimalDegrees :: Double -> Angle Source #

Angle from given decimal degrees. Any Double is accepted: it must be validated by the call site when used to represent a latitude or longitude.

dms :: Int -> Int -> Int -> Int -> Angle Source #

Angle from the given degrees, minutes, seconds and milliseconds. errors if given minutes, seconds and/or milliseconds are invalid. Degrees are not validated and can be any Int: they must be validated by the call site when used to represent a latitude or longitude.

dmsE :: Int -> Int -> Int -> Int -> Either String Angle Source #

Angle from the given degrees, minutes, seconds and milliseconds. A Left indicates that given minutes, seconds and/or milliseconds are invalid. Degrees are not validated and can be any Int: they must be validated by the call site when used to represent a latitude or longitude.

dmsF :: MonadFail m => Int -> Int -> Int -> Int -> m Angle Source #

Angle from the given degrees, minutes, seconds and milliseconds. fails if given minutes, seconds and/or milliseconds are invalid. Degrees are not validated and can be any Int: they must be validated by the call site when used to represent a latitude or longitude.

radians :: Double -> Angle Source #

Angle from the given radians.

Calculations

arcLength :: Angle -> Length -> Length Source #

arcLength a r computes the Length of the arc that subtends the angle a for radius r.

central :: Length -> Length -> Angle Source #

central l r computes the central Angle from the arc length l and radius r.

isNegative :: Angle -> Bool Source #

Is given Angle < 0?

isWithin :: Angle -> Angle -> Angle -> Bool Source #

Is given Angle within range [low..high] inclusive?

negate' :: Angle -> Angle Source #

Returns the given Angle negated.

normalise :: Angle -> Angle -> Angle Source #

normalise a n normalises a to [0, n].

Trigonometric functions

asin' :: Double -> Angle Source #

asin' a computes arc sine of a.

atan2' :: Double -> Double -> Angle Source #

atan2' y x computes the Angle (from the positive x-axis) of the vector from the origin to the point (x,y).

cos' :: Angle -> Double Source #

cos' a returns the cosinus of a.

sin' :: Angle -> Double Source #

sin' a returns the sinus of a.

Accessors

getDegrees :: Angle -> Int Source #

getDegrees a returns the degree component of a.

getMinutes :: Angle -> Int Source #

getMinutes a returns the minute component of a.

getSeconds :: Angle -> Int Source #

getSeconds a returns the second component of a.

getMilliseconds :: Angle -> Int Source #

getMilliseconds a returns the milliseconds component of a.

Conversions

toDecimalDegrees :: Angle -> Double Source #

Converts the given Angle to decimal degrees.

toRadians :: Angle -> Double Source #

degrees to radians.

Read

angle :: ReadP Angle Source #

Parses and returns an Angle.

readAngle :: String -> Angle Source #

Obtains a Angle from the given string formatted as either:

  • d°m′s.ms″ - e.g. 55°36'21.3", where minutes, seconds and milliseconds are optional.
  • decimal° - e.g. 55.6050° or -133°

Symbols:

  • degree: ° or d
  • minute: ', ′ or m
  • second: ", ″, '' or s

This simply calls read s :: Angle so error should be handled at the call site.

readAngleE :: String -> Either String Angle Source #

Same as readAngle but returns an Either.

readAngleF :: MonadFail m => String -> m Angle Source #

Same as readAngle but returns a MonadFail.