Safe Haskell | None |
---|---|

Language | Haskell2010 |

## Synopsis

- class GridClass r e | r -> e where
- data GridPoint r = GridPoint {}
- data GridOffset = GridOffset {}
- polarOffset :: Length Double -> Angle Double -> GridOffset
- offsetScale :: Dimensionless Double -> GridOffset -> GridOffset
- offsetNegate :: GridOffset -> GridOffset
- applyOffset :: GridOffset -> GridPoint g -> GridPoint g
- offsetDistance :: GridOffset -> Length Double
- offsetDistanceSq :: GridOffset -> Area Double
- offsetBearing :: GridOffset -> Angle Double
- gridOffset :: GridPoint g -> GridPoint g -> GridOffset
- unsafeGridCoerce :: b -> GridPoint a -> GridPoint b
- fromGridDigits :: Length Double -> String -> Maybe (Length Double, Length Double)
- toGridDigits :: Length Double -> Int -> Length Double -> Maybe (Integer, String)

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

fromGrid :: GridPoint r -> Geodetic e Source #

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

gridEllipsoid :: r -> e Source #

## Instances

GridClass UkNationalGrid OSGB36 Source # | |

Defined in Geodetics.UK | |

Ellipsoid e => GridClass (GridStereo e) e Source # | |

Defined in Geodetics.Stereographic fromGrid :: GridPoint (GridStereo e) -> Geodetic e Source # toGrid :: GridStereo e -> Geodetic e -> GridPoint (GridStereo e) Source # gridEllipsoid :: GridStereo e -> e Source # | |

Ellipsoid e => GridClass (GridTM e) e Source # | |

A point on the specified grid.

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.

## Instances

Eq GridOffset Source # | |

Defined in Geodetics.Grid (==) :: GridOffset -> GridOffset -> Bool # (/=) :: GridOffset -> GridOffset -> Bool # | |

Show GridOffset Source # | |

Defined in Geodetics.Grid showsPrec :: Int -> GridOffset -> ShowS # show :: GridOffset -> String # showList :: [GridOffset] -> ShowS # | |

Semigroup GridOffset Source # | |

Defined in Geodetics.Grid (<>) :: GridOffset -> GridOffset -> GridOffset # sconcat :: NonEmpty GridOffset -> GridOffset # stimes :: Integral b => b -> GridOffset -> GridOffset # | |

Monoid GridOffset Source # | |

Defined in Geodetics.Grid mempty :: GridOffset # mappend :: GridOffset -> GridOffset -> GridOffset # mconcat :: [GridOffset] -> GridOffset # |

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

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

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`

.

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