| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Geodetics.MGRS
Description
The Military Grid Reference System (MGRS)
In MGRS there are two syntaxes for grid references:
- Between 80 South and 84 North a grid reference has a zone number, latitude band letter, a 2 letter code for the 100km square within the zone, and then northings and eastings within that square.
- In the polar regions a grid reference has a latitude band letter (A or B for South, Y or Z for North), a 2 letter code for the 100km square within the polar region, and then northings and eastings within that square. There is no zone number in the polar regions.
Synopsis
- data MgrsGrid
- mgrsGrid :: Geodetic WGS84 -> MgrsGrid
- utmToMgrsPoint :: GridPoint UtmZone -> GridPoint MgrsGrid
- upsToMgrsPoint :: GridPoint UpsGrid -> GridPoint MgrsGrid
- fromMgrsPoint :: GridPoint MgrsGrid -> Either (GridPoint UtmZone) (GridPoint UpsGrid)
- mgrsBandLetterToLatitude :: Char -> Maybe Double
- mgrsLatitudeToBandLetter :: Double -> Maybe Char
- fromMgrsGridReference :: String -> Either [String] (GridPoint MgrsGrid, GridOffset)
- toMgrsGridReference :: Bool -> Int -> GridPoint MgrsGrid -> Maybe String
MGRS Grid Basis
MGRS grid references can be anywhere on Earth. Hence the position can be either on a UTM or a UPS grid.
mgrsGrid :: Geodetic WGS84 -> MgrsGrid Source #
Find the most appropriate grid for the given geodetic position
fromMgrsPoint :: GridPoint MgrsGrid -> Either (GridPoint UtmZone) (GridPoint UpsGrid) Source #
Convert an MGRS grid point to either UTM or UPS, depending on its basis.
Textual Representation
mgrsBandLetterToLatitude :: Char -> Maybe Double Source #
Find the southern boundary of a latitude band letter (excluding poles).
mgrsLatitudeToBandLetter :: Double -> Maybe Char Source #
Find the band letter for a latitude, if it is in the range (-80, 84) degrees. (Argument in radians)
fromMgrsGridReference :: String -> Either [String] (GridPoint MgrsGrid, GridOffset) Source #
Convert an MGRS grid reference to a UTM GridPoint, if the reference is valid.
E.g. "30U XC 99304 10208" is the grid reference for Nelson's Column in London.
If the input contains spaces then these are used to delimit the fields. Multiple spaces are treated as a single space.
If the reference is valid this returns the position of the south-west corner of the nominated grid square and an offset to its centre. Altitude is set to zero.