jord-0.5.0.0: Geographical Position Calculations

Copyright (c) 2018 Cedric Liegeois BSD3 Cedric Liegeois experimental portable Safe Haskell2010

Data.Geo.Jord.Angle

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
 Source # Instance detailsDefined in Data.Geo.Jord.Angle Methods(==) :: Angle -> Angle -> Bool #(/=) :: Angle -> Angle -> Bool # Source # See readAngle. Instance detailsDefined in Data.Geo.Jord.Angle Methods Source # Angle is shown degrees, minutes, seconds and milliseconds - e.g. 154°25'43.5". Instance detailsDefined in Data.Geo.Jord.Angle MethodsshowsPrec :: Int -> Angle -> ShowS #show :: Angle -> String #showList :: [Angle] -> ShowS # Source # Add/Subtract Angles. Instance detailsDefined in Data.Geo.Jord.Angle Methods NTransform a => IsGreatCircle (a, Angle) Source # GreatCircle passing by the given position and heading on given bearing. greatCircle (readLatLong "283321N0290700W", decimalDegrees 33.0)  Instance detailsDefined in Data.Geo.Jord.Geodetics MethodsgreatCircle :: (a, Angle) -> GreatCircle Source #greatCircleF :: MonadFail m => (a, Angle) -> m GreatCircle Source #

# Smart constructors

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.

Angle from the given radians.

# Calculations

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

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

Is given Angle < 0?

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

Returns the given Angle negated.

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

# Trigonometric functions

asin' a computes arc sine of a.

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

cos' a returns the cosinus of a.

sin' a returns the sinus of a.

# Accessors

getDegrees a returns the degree component of a.

getMinutes a returns the minute component of a.

getSeconds a returns the second component of a.

getMilliseconds a returns the milliseconds component of a.

# Conversions

Converts the given Angle to decimal degrees.

degrees to radians.

# Read

Parses and returns an Angle.

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.

Same as readAngle but returns an Either.

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

Same as readAngle but returns a MonadFail.