geodetics-0.0.5: Terrestrial coordinate systems and geodetic calculations.

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.

Minimal complete definition

Methods

toGrid :: r -> Geodetic e -> GridPoint r Source #

gridEllipsoid :: r -> e Source #

Instances

 Source # Methods Ellipsoid e => GridClass (GridStereo e) e Source # MethodstoGrid :: GridStereo e -> Geodetic e -> GridPoint (GridStereo e) Source #gridEllipsoid :: GridStereo e -> e Source # Ellipsoid e => GridClass (GridTM e) e Source # MethodstoGrid :: GridTM e -> Geodetic e -> GridPoint (GridTM e) Source #gridEllipsoid :: GridTM e -> e Source #

data GridPoint r Source #

A point on the specified grid.

Constructors

 GridPoint Fieldseastings, northings, altGP :: Length Double gridBasis :: r

Instances

 Eq (GridPoint r) Source # Methods(==) :: GridPoint r -> GridPoint r -> Bool #(/=) :: GridPoint r -> GridPoint r -> Bool # Show r => Show (GridPoint r) Source # MethodsshowsPrec :: Int -> GridPoint r -> ShowS #show :: GridPoint r -> String #showList :: [GridPoint r] -> ShowS # Source # Methods

A vector relative to a point on a grid. 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.

Constructors

 GridOffset FieldsdeltaEast, deltaNorth, deltaAltitude :: Length Double

Instances

 Source # Methods Source # MethodsshowList :: [GridOffset] -> ShowS # Source # Methodsstimes :: Integral b => b -> GridOffset -> GridOffset # Source # Methodsmconcat :: [GridOffset] -> GridOffset #

## Grid operations

An offset defined by a distance and a bearing 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.

Scale an offset by a scalar.

Invert an offset.

The distance represented by an offset.

The square of the distance represented by an offset.

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

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

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 *~ kilo meter) "237" will return

Just (23700 meters, 100 meters)

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

Arguments

 :: Length Double Size of enclosing grid square. Must be at least 1 km. -> Int Number of digits to return. Must be positive. -> Length Double Offset to convert into grid. -> Maybe (Integer, String)

Convert a distance into a digit string suitable for printing as part of a grid reference. The result is the nearest position to the specified number of digits, expressed as an integer count of squares and a string of digits. If any arguments are invalid then Nothing is returned.