Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Geodetics.UTM
Description
Universal Transverse Mercator (UTM)
The UTM grid system covers the whole world between 84°N and 80°S. It divides the world into grid zones of 6° longitude by 8° latitude. Each zone has a 2 digit number for longitude and a letter for latitude. This regular system has two exceptions:
- North of Norway the zones 32X, 34X and 36X are not used, with 31X, 33X, 35X and 37X being wider instead.
- Zone 32V is widened to cover the south-western end of Norway.
There are two notations for writing UTM grid positions:
- The UTM standard: Zone number, N or S for hemisphere, and then northings and eastings relative to the equator.
- The Military Grid Reference System (MGRS): 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 this library each UTM longitude zone has two grids, one for the northern hemisphere and one for the south.
For more details see
- https://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system.
- THE UNIVERSAL GRIDS: Universal Transverse Mercator (UTM) and Universal Polar Stereographic (UPS). DMA Technical Manual. AD-A226497. https://apps.dtic.mil/sti/tr/pdf/ADA266497.pdf
Synopsis
- data UtmHemisphere
- type UtmZoneNumber = Int
- utmZoneNumber :: Geodetic a -> Maybe UtmZoneNumber
- data UtmZone
- utmZone :: Geodetic a -> Maybe UtmZone
- mkUtmZone :: UtmHemisphere -> UtmZoneNumber -> Maybe UtmZone
- mkUtmZoneUnsafe :: UtmHemisphere -> UtmZoneNumber -> UtmZone
- fromUtmGridReference :: String -> Either [String] (GridPoint UtmZone)
- toUtmGridReference :: Maybe UtmGridUnit -> Bool -> Int -> GridPoint UtmZone -> String
- mgrsBandLetterToLatitude :: Char -> Maybe Double
- mgrsLatitudeToBandLetter :: Double -> Maybe Char
- fromMgrsGridReference :: String -> Either [String] (GridPoint UtmZone, GridOffset)
- toMgrsGridReference :: Bool -> Int -> GridPoint UtmZone -> Maybe String
Documentation
data UtmHemisphere Source #
In UTM the northern and southern hemispheres have different false origins.
Instances
Show UtmHemisphere Source # | |
Defined in Geodetics.UTM Methods showsPrec :: Int -> UtmHemisphere -> ShowS # show :: UtmHemisphere -> String # showList :: [UtmHemisphere] -> ShowS # | |
Eq UtmHemisphere Source # | |
Defined in Geodetics.UTM Methods (==) :: UtmHemisphere -> UtmHemisphere -> Bool # (/=) :: UtmHemisphere -> UtmHemisphere -> Bool # |
type UtmZoneNumber = Int Source #
A UTM Zone number. Must be between 1 and 60.
utmZoneNumber :: Geodetic a -> Maybe UtmZoneNumber Source #
A UTM Zone, representing a band of typically 6 degrees of latitude between the equator and one of the poles. The projection *must* match the hemisphere and zone.
mkUtmZone :: UtmHemisphere -> UtmZoneNumber -> Maybe UtmZone Source #
Construct a UTM Zone value. Returns Nothing
if the zone number is out of range.
mkUtmZoneUnsafe :: UtmHemisphere -> UtmZoneNumber -> UtmZone Source #
Construct a UTM Zone value without checking whether the zone number is valid.
fromUtmGridReference :: String -> Either [String] (GridPoint UtmZone) Source #
Convert a grid reference to a position, if the reference is valid.
The northings and eastings cannot contain more than 20 digits each, including an optional decimal point. Negative values are not permitted.
Northings and eastings can each be followed by an optional unit. The unit must be either "m" or "km". The units for both must be the same because otherwise its probably an error. The default is meters.
Northings may be followed by an "N" and Eastings may be followed by an "E".
If the argument cannot be parsed then one or more error messages are returned.
Arguments
:: Maybe UtmGridUnit | Include explicit units in the output. |
-> Bool | Include "E" and "N" in the output. |
-> Int | Digits of resolution. 0 = 1m resolution, 1 = 10m, 2 = 100m etc. (-2) = 1cm. |
-> GridPoint UtmZone | |
-> String |
Convert a grid point to a UTM grid reference. The northings and eastings are rounded down to the resolution, so the result is the south-west corner of the grid square enclosing the grid point.
mgrsBandLetterToLatitude :: Char -> Maybe Double Source #
Find the southern boundary of a latitude band letter.
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 UtmZone, 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. Any or all spaces may be omitted. 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.