geodetics-2.0.0: Terrestrial coordinate systems and geodetic calculations.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Geodetics.MGRS

Description

The Military Grid Reference System (MGRS)

In MGRS there are two syntaxes for grid references:

  1. 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.
  2. 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

MGRS Grid Basis

data MgrsGrid Source #

MGRS grid references can be anywhere on Earth. Hence the position can be either on a UTM or a UPS grid.

Instances

Instances details
Show MgrsGrid Source # 
Instance details

Defined in Geodetics.MGRS

Eq MgrsGrid Source # 
Instance details

Defined in Geodetics.MGRS

GridClass MgrsGrid WGS84 Source # 
Instance details

Defined in Geodetics.MGRS

mgrsGrid :: Geodetic WGS84 -> MgrsGrid Source #

Find the most appropriate grid for the given geodetic position

utmToMgrsPoint :: GridPoint UtmZone -> GridPoint MgrsGrid Source #

Generalise from UTM to MGRS

upsToMgrsPoint :: GridPoint UpsGrid -> GridPoint MgrsGrid Source #

Generalise from UPS to MGRS

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.

toMgrsGridReference Source #

Arguments

:: Bool

Include spaces in the output. The standard says no spaces, but they make the output easier to read.

-> Int

Number of digits of precision in the easting and northing. Must be 0-8.

-> GridPoint MgrsGrid 
-> Maybe String 

Convert a UTM or UPS GridPoint to an MGRS grid reference.