geodetics-0.0.5: Terrestrial coordinate systems and geodetic calculations.

Safe HaskellNone
LanguageHaskell2010

Geodetics.Grid

Contents

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

fromGrid, toGrid, gridEllipsoid

data GridPoint r Source #

A point on the specified grid.

Constructors

GridPoint 

data GridOffset Source #

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.

Grid operations

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

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.

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

Scale an offset by a scalar.

offsetNegate :: GridOffset -> GridOffset Source #

Invert an offset.

offsetDistance :: GridOffset -> Length Double Source #

The distance represented by an offset.

offsetDistanceSq :: GridOffset -> Area Double Source #

The square of the distance represented by an offset.

offsetBearing :: GridOffset -> Angle 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 :: Length Double -> String -> Maybe (Length Double, Length 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 *~ kilo meter) "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

:: 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.