jord-0.1.0.0: Geographic position calculations on Great Circles

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

Data.Geo.Jord.GeoPos

Contents

Description

Types to represent a geographic position by its latitude and longitude.

Synopsis

The GeoPos type

data GeoPos Source #

A geographic position (latitude and longitude).

Instances
Eq GeoPos Source # 
Instance details

Defined in Data.Geo.Jord.GeoPos

Methods

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

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

Read GeoPos Source #

See readGeoPos.

Instance details

Defined in Data.Geo.Jord.GeoPos

Show GeoPos Source # 
Instance details

Defined in Data.Geo.Jord.GeoPos

Position GeoPos Source #

GeoPos to/from NVector.

Instance details

Defined in Data.Geo.Jord.GreatCircle

Smart constructors

latLong :: Angle -> Angle -> GeoPos Source #

GeoPos from given latitude and longitude. errors if given latitude is outisde [-90..90]° and/or given longitude is outisde [-180..180]°.

latLongE :: Angle -> Angle -> Either String GeoPos Source #

GeoPos from given latitude and longitude. A Left indicates that the given latitude is outisde [-90..90]° and/or given longitude is outisde [-180..180]°.

latLongF :: MonadFail m => Angle -> Angle -> m GeoPos Source #

GeoPos from given latitude and longitude. fails if given latitude is outisde [-90..90]° and/or given longitude is outisde [-180..180]°.

latLongDecimal :: Double -> Double -> GeoPos Source #

GeoPos from given latitude and longitude in decimal degrees. errors if given latitude is outisde [-90..90]° and/or given longitude is outisde [-180..180]°.

latLongDecimalE :: Double -> Double -> Either String GeoPos Source #

GeoPos from given latitude and longitude in decimal degrees. A Left indicates that the given latitude is outisde [-90..90]° and/or given longitude is outisde [-180..180]°.

latLongDecimalF :: MonadFail m => Double -> Double -> m GeoPos Source #

GeoPos from given latitude and longitude in decimal degrees. fails if given latitude is outisde [-90..90]° and/or given longitude is outisde [-180..180]°.

read

readGeoPos :: String -> GeoPos Source #

Obtains a GeoPos from the given string formatted as either:

  • DD(MM)(SS)[N|S]DDD(MM)(SS)[E|W] - e.g. 553621N0130002E or 0116S03649E or 47N122W
  • Angle[N|S] Angle[E|W] - e.g. 55°36'21''N 13°0'02''E or 11°16'S 36°49'E or 47°N 122°W

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

readGeoPosF :: MonadFail m => String -> m GeoPos Source #

Same as readGeoPos but returns a MonadFail.

Misc.

toDecimalDegrees' :: GeoPos -> (Double, Double) Source #

Converts the given GeoPos to tuple of latitude and longitude in decimal degrees.