geodetics-0.0.2: Terrestrial coordinate systems and associated calculations.

Safe HaskellNone

Geodetics.Grid

Contents

Synopsis

Grid types

class GridClass r e | r -> e whereSource

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.

Instances

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 -> GridOffsetSource

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 -> GridOffsetSource

Scale an offset by a scalar.

offsetNegate :: GridOffset -> GridOffsetSource

Invert an offset.

offsetDistance :: GridOffset -> Length DoubleSource

The distance represented by an offset.

offsetDistanceSq :: GridOffset -> Area DoubleSource

The square of the distance represented by an offset.

offsetBearing :: GridOffset -> Angle DoubleSource

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

gridOffset :: GridPoint g -> GridPoint g -> GridOffsetSource

The offset required to move from p1 to p2.

Unsafe conversion

unsafeGridCoerce :: b -> GridPoint a -> GridPoint bSource

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.

toGridDigitsSource

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.