geodetics-1.1.0: Terrestrial coordinate systems and geodetic calculations.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Geodetics.Grid

Synopsis

Grid types

class GridClass r e | r -> e where Source #

A Grid is a two-dimensional projection of the ellipsoid onto a plane. Any given type of grid can usually be instantiated with parameters such as a tangential point or line, and these parameters will include the terrestrial reference frame (Ellipsoid in this library) used as a foundation. Hence conversion from a geodetic to a grid point requires the "basis" for the grid in question, and grid points carry that basis with them because without it there is no defined relationship between the grid points and terrestrial positions.

data GridPoint r Source #

A point on the specified grid.

Constructors

GridPoint 

Instances

Instances details
Show r => Show (GridPoint r) Source # 
Instance details

Defined in Geodetics.Grid

HasAltitude (GridPoint g) Source # 
Instance details

Defined in Geodetics.Grid

Eq r => Eq (GridPoint r) Source # 
Instance details

Defined in Geodetics.Grid

Methods

(==) :: GridPoint r -> GridPoint r -> Bool #

(/=) :: GridPoint r -> GridPoint r -> Bool #

data GridOffset Source #

A vector relative to a point on a grid. All distances are in meters. Operations that use offsets will only give meaningful results if all the points come from the same grid.

The monoid instance is the sum of offsets.

Instances

Instances details
Monoid GridOffset Source # 
Instance details

Defined in Geodetics.Grid

Semigroup GridOffset Source # 
Instance details

Defined in Geodetics.Grid

Show GridOffset Source # 
Instance details

Defined in Geodetics.Grid

Eq GridOffset Source # 
Instance details

Defined in Geodetics.Grid

Grid operations

polarOffset :: Double -> Double -> GridOffset Source #

An offset defined by a distance (m) and a bearing (radians) to the right of North.

There is no elevation parameter because we are using a plane to approximate an ellipsoid, so elevation would not provide a useful result. If you want to work with elevations then "rayPath" will give meaningful results.

offsetScale :: Double -> GridOffset -> GridOffset Source #

Scale an offset by a scalar.

offsetNegate :: GridOffset -> GridOffset Source #

Invert an offset.

offsetDistance :: GridOffset -> Double Source #

The distance represented by an offset.

offsetDistanceSq :: GridOffset -> Double Source #

The square of the distance represented by an offset.

offsetBearing :: GridOffset -> Double Source #

The direction represented by an offset, as bearing to the right of North.

gridOffset :: GridPoint g -> GridPoint g -> GridOffset Source #

The offset required to move from p1 to p2.

Unsafe conversion

unsafeGridCoerce :: b -> GridPoint a -> GridPoint b Source #

Coerce a grid point of one type into a grid point of a different type, but with the same easting, northing and altitude. This is unsafe because it will produce a different position unless the two grids are actually equal.

It should be used only to convert between distinguished grids (e.g. UkNationalGrid) and their equivalent numerical definitions.

Utility functions for grid references

fromGridDigits :: Double -> String -> Maybe (Double, Double) Source #

Convert a list of digits to a distance. The first argument is the size of the grid square within which these digits specify a position. The first digit is in units of one tenth of the grid square, the second one hundredth, and so on. The first result is the lower limit of the result, and the second is the size of the specified offset. So for instance fromGridDigits (100 * kilometer) "237" will return

Just (23700 meters, 100 meters)

If there are any non-digits in the string then the function returns Nothing.

toGridDigits Source #

Arguments

:: Double

Size of enclosing grid square. Must be at least 1000m.

-> Int

Number of digits to return. Must be positive.

-> Double

Offset to convert into grid (m).

-> Maybe (Integer, String) 

Convert a distance into a digit string suitable for printing as part of a grid reference. The result is the south or west side of the enclosing grid square, where the size of the square is defined by the number of digits. The result is expressed as an integer count of squares and a string of digits. If any arguments are invalid then Nothing is returned.