jord-0.1.0.0: Geographic position calculations on Great Circles

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

Data.Geo.Jord.Eval

Contents

Description

Types and functions for evaluating expressions in textual form.

Synopsis

# Documentation

data Value Source #

A value accepted and returned by eval.

Constructors

 Ang Angle Angle AngDec Double Angle in decimal degrees Bool Bool boolean Double Double double Len Length Length Gc GreatCircle GreatCircle Geo GeoPos GeoPos Geos [GeoPos] list of GeoPos GeoDec (Double, Double) latitude and longitude in decimal degrees GeosDec [(Double, Double)] list of latitude and longitude in decimal degrees Vec NVector NVector Vecs [NVector] list of NVectors
Instances
 Source # Instance detailsDefined in Data.Geo.Jord.Eval Methods(==) :: Value -> Value -> Bool #(/=) :: Value -> Value -> Bool # Source # Instance detailsDefined in Data.Geo.Jord.Eval MethodsshowsPrec :: Int -> Value -> ShowS #show :: Value -> String #showList :: [Value] -> ShowS #

data Vault Source #

A location for Values to be shared by successive evalations.

Either an error or a Value.

An empty Vault.

Evaluates s, an expression of the form "(f x y ..)".

>>> eval "finalBearing (destination (antipode 54°N,154°E) 54° 1000m) 54°N,154°E"
126°


f must be one of the supported functions and each parameter x, y, .. , is either another function call or a String parameter. Parameters are either resolved by name using the Resolve function r or if it returns Nothing, read to an Angle, a Length or a GeoPos.

If the evaluation is successful, returns the resulting Value (Right) otherwise a description of the error (Left).

    vault = emptyVault
angle = eval "finalBearing 54N154E 54S154W" vault -- Right Ang
length = eval "distance (antipode 54N154E) 54S154W" vault -- Right Len
-- parameter resolution from vault
a1 = eval "finalBearing 54N154E 54S154W" vault
vault = insert "a1" vault
a2 = eval "(finalBearing a1 54S154W)" vault


By default, all returned positions are Geo (GeoPos), to get back a Vec (NVector), the expression must be wrapped by toNVector.

    dest = eval "destination 54°N,154°E 54° 1000m" -- Right Geo
dest = eval "toNVector (destination 54°N,154°E 54° 1000m)" -- Right Vec


Every function call must be wrapped between parentheses, however they can be ommitted for the top level call.

    angle = eval "finalBearing 54N154E 54S154W" -- Right Ang
angle = eval "(finalBearing 54N154E 54S154W)" -- Right Ang
length = eval "distance (antipode 54N154E) 54S154W" -- Right Len
length = eval "distance antipode 54N154E 54S154W" -- Left String


All supported functions:

• antipode
• crossTrackDistance
• decimalDegrees
• destination
• distance
• finalBearing
• greatCircle
• initialBearing
• interpolate
• intersections
• isInside
• mean
• latLong
• latLongDecimal
• readGeoPos
• toDecimalDegrees
• toKilometres
• toMetres
• toNauticalMiles
• toNVector

insert k v vault inserts value v for key k. Overwrites any previous value.

delete k vault deletes key k from the vault.

lookup k vault looks up the value of key k in the vault.

# Orphan instances

 Source # Instance details Methods