-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Easily convert between latitude/longitude, UTM and OSGB. -- -- Please see README.md @package hcoord @version 1.0.0.0 module MathExtensions toRadians :: Double -> Double toDegrees :: Double -> Double sinSquared :: Double -> Double sinCubed :: Double -> Double cosSquared :: Double -> Double cosCubed :: Double -> Double tanSquared :: Double -> Double sec :: Double -> Double module Ellipsoid -- | To represent a reference ellipsoid. data Ellipsoid Ellipsoid :: Double -> Double -> Double -> Double -> Ellipsoid -- | Semi major axis. [semiMajorAxis] :: Ellipsoid -> Double -- | Semi minor axis. [semiMinorAxis] :: Ellipsoid -> Double -- | Eccentricity squared. [eccentricitySquared] :: Ellipsoid -> Double -- | Flattening. [flattening] :: Ellipsoid -> Double -- | Parameters to build Ellipsoid. data EllipsoidParams -- | Semi major and semi minor axises. SemiMajMinAxises :: Double -> Double -> EllipsoidParams -- | Semi major axis and eccentric squared. SemiMajAxisEccentricitySquared :: Double -> Double -> EllipsoidParams -- | Create an Ellipsoid with the given parameters. mkEllipsoid :: EllipsoidParams -> Ellipsoid -- | Pre-determined ellipsoids: airy1830Ellipsoid :: Ellipsoid australianNational1966Ellipsoid :: Ellipsoid bessel1841Ellipsoid :: Ellipsoid clarke1866Ellipsoid :: Ellipsoid clarke1880Ellipsoid :: Ellipsoid everest1830Ellipsoid :: Ellipsoid fischer1960Ellipsoid :: Ellipsoid fischer1968Ellipsoid :: Ellipsoid grs67Ellipsoid :: Ellipsoid grs75Ellipsoid :: Ellipsoid grs80Ellipsoid :: Ellipsoid hayford1910Ellipsoid :: Ellipsoid helmert1906Ellipsoid :: Ellipsoid hough1956Ellipsoid :: Ellipsoid iers1989Ellipsoid :: Ellipsoid internationalEllipsoid :: Ellipsoid krassovsky1940Ellipsoid :: Ellipsoid modifiedAiryEllipsoid :: Ellipsoid modifiedEverestEllipsoid :: Ellipsoid newInternational1967Ellipsoid :: Ellipsoid southAmerican1969Ellipsoid :: Ellipsoid wgs60Ellipsoid :: Ellipsoid wgs66Ellipsoid :: Ellipsoid wgs72Ellipsoid :: Ellipsoid wgs84Ellipsoid :: Ellipsoid instance GHC.Classes.Eq Ellipsoid.Ellipsoid instance GHC.Show.Show Ellipsoid.Ellipsoid module Datum -- | To represent a set of parameters for describing a particular datum, -- including a name, the reference ellipsoid used and the seven -- parameters required to translate co-ordinates in this datum to the -- WGS84 datum. data Datum Datum :: String -> Ellipsoid -> Double -> Double -> Double -> Double -> Double -> Double -> Double -> Datum -- | The name of this Datum. [name] :: Datum -> String -- | The reference ellipsoid associated with this Datum. [ellipsoid] :: Datum -> Ellipsoid -- | Translation along the x-axis for use in 7-parameter Helmert -- transformations. This value should be used to convert a co-ordinate in -- a given datum to the WGS84 datum. [dx] :: Datum -> Double -- | Translation along the y-axis for use in 7-parameter Helmert -- transformations. This value should be used to convert a co-ordinate in -- a given datum to the WGS84 datum. [dy] :: Datum -> Double -- | Translation along the z-axis for use in 7-parameter Helmert -- transformations. This value should be used to convert a co-ordinate in -- a given datum to the WGS84 datum. [dz] :: Datum -> Double -- | Scale factor for use in 7-parameter Helmert transformations. This -- value should be used to convert a co-ordinate in a given datum to the -- WGS84 datum. [ds] :: Datum -> Double -- | Rotation about the x-axis for use in 7-parameter Helmert -- transformations. This value should be used to convert a co-ordinate in -- a given datum to the WGS84 datum. [rx] :: Datum -> Double -- | Rotation about the y-axis for use in 7-parameter Helmert -- transformations. This value should be used to convert a co-ordinate in -- a given datum to the WGS84 datum. [ry] :: Datum -> Double -- | Rotation about the z-axis for use in 7-parameter Helmert -- transformations. This value should be used to convert a co-ordinate in -- a given datum to the WGS84 datum. [rz] :: Datum -> Double -- | Pre-determined data: etrf89Datum :: Datum ireland1965Datum :: Datum osgb36Datum :: Datum wgs84Datum :: Datum nad27GreenlandDatum :: Datum nad27WesternUSDatum :: Datum nad27AlaskaDatum :: Datum nad27CentralAmericaDatum :: Datum nad27SanSalvadorDatum :: Datum nad27AlbertaBritishColumbiaDatum :: Datum nad27CanadaEastDatum :: Datum nad27ContiguousUSDatum :: Datum nad27MexicoDatum :: Datum nad27BahamasDatum :: Datum nad27CanadaNWTerritoryDatum :: Datum nad27CanadaManitobaOntarioDatum :: Datum nad27CanadaDatum :: Datum nad27CanadaYukonDatum :: Datum nad27CubaDatum :: Datum nad27AleutianWestDatum :: Datum nad27AleutianEastDatum :: Datum nad27CanalZoneDatum :: Datum nad27EasternUSDatum :: Datum nad27CaribbeanDatum :: Datum instance GHC.Show.Show Datum.Datum instance GHC.Classes.Eq Datum.Datum -- | To represent a latitude/longitude pair based on a particular datum. module LatLng data LatLng LatLng :: Double -> Double -> Double -> Datum -> LatLng [latitude] :: LatLng -> Double [longitude] :: LatLng -> Double [height] :: LatLng -> Double [datum] :: LatLng -> Datum mkLatLng :: Double -> Double -> Double -> Datum -> Except String LatLng calcPhiN' :: Double -> Double -> Double -> Double -> Double -> Double -- | Convert this LatLng from the OSGB36 datum to the WGS84 datum using an -- approximate Helmert transformation. toWGS84 :: LatLng -> LatLng toDatum :: LatLng -> Datum -> LatLng -- | Convert this LatLng from the WGS84 datum to the OSGB36 datum using an -- approximate Helmert transformation. toOSGB36 :: LatLng -> LatLng -- | Calculate the surface distance in kilometres from this LatLngPoint to -- the given LatLngPoint. distance :: LatLng -> LatLng -> Double -- | Calculate the surface distance in miles from this LatLngPoint to the -- given LatLngPoint. distanceMiles :: LatLng -> LatLng -> Double latitudeDegrees :: LatLng -> Int longitudeDegrees :: LatLng -> Int calcDegrees :: Double -> Int latitudeMinutes :: LatLng -> Int longitudeMinutes :: LatLng -> Int calcMinutes :: Double -> Int latitudeSeconds :: LatLng -> Double longitudeSeconds :: LatLng -> Double calcSeconds :: Double -> Double instance GHC.Show.Show LatLng.LatLng module ECEFRef -- | ECEF (earth-centred, earth-fixed) Cartesian co-ordinates are used to -- define a point in three-dimensional space. ECEF co-ordinates are -- defined relative to an x-axis (the intersection of the equatorial -- plane and the plane defined by the prime meridian), a y-axis (at -- 90° to the x-axis and its intersection with the equator) and a -- z-axis (intersecting the North Pole). All the axes intersect at the -- point defined by the centre of mass of the Earth. data ECEFRef ECEFRef :: Double -> Double -> Double -> Datum -> ECEFRef [x] :: ECEFRef -> Double [y] :: ECEFRef -> Double [z] :: ECEFRef -> Double [datum] :: ECEFRef -> Datum -- | Create a new earth-centred, earth-fixed reference from the given -- latitude and longitude. toECEFRef :: LatLng -> ECEFRef -- | Convert this ECEFRef object to a LatLng. toLatLng :: ECEFRef -> LatLng instance GHC.Show.Show ECEFRef.ECEFRef -- | To represent an Irish National Grid reference. -- -- Projection: Transverse Mercator Reference ellipsoid: Modified Airy -- Units: metres Origin: 53°30'N, 8°W False co-ordinates -- of origin: 200000m east, 250000m north module IrishRef data IrishRef IrishRef :: Double -> Double -> Datum -> IrishRef -- | The easting in metres relative to the origin of the British National -- Grid. [easting] :: IrishRef -> Double -- | The northing in metres relative to the origin of the British National -- Grid. [northing] :: IrishRef -> Double [datum] :: IrishRef -> Datum scaleFactor :: Double falseOriginLatitude :: Double falseOriginLongitude :: Double falseOriginEasting :: Double falseOriginNorthing :: Double -- | Create a new Ordnance Survey grid reference using a given easting and -- northing. The easting and northing must be in metres and must be -- relative to the origin of the British National Grid. mkIrishRef :: Double -> Double -> Except String IrishRef -- | Take a string formatted as a six-figure OS grid reference (e.g. -- TG514131) and create a new OSRef object that represents that -- grid reference. The first character must be H, N, S, O or T. The -- second character can be any uppercase character from A through Z -- excluding I. mkIrishRef' :: String -> Except String IrishRef -- | Create an IrishRef object from the given latitude and longitude. mkIrishRef'' :: LatLng -> Except String IrishRef -- | Return a String representation of this Irish grid reference using the -- six-figure notation in the form X123456 toSixFigureString :: IrishRef -> String -- | Convert this Irish grid reference to a latitude/longitude pair using -- the Ireland 1965 datum. Note that, the LatLng object may need to be -- converted to the WGS84 datum depending on the application. toLatLng :: IrishRef -> Except String LatLng -- | Validate the easting. evalEasting :: Double -> Except String Double -- | Validate the northing. evalNorthing :: Double -> Except String Double instance GHC.Show.Show IrishRef.IrishRef -- | To represent an Ordnance Survey of Great Britain (OSGB) grid -- reference. -- -- British National Grid Projection: Transverse Mercator Reference -- ellipsoid: Airy 1830 Units: metres Origin: 49°N, 2°W -- False co-ordinates of origin: 400000m east, -100000m north -- -- A full reference includes a two-character code identifying a -- particular 100,000m grid square. The table below shows how the -- two-character 100,000m grid squares are identified. The bottom left -- corner is at the false origin of the grid. Squares without values fall -- outside the boundaries of the British National Grid. -- -- km 0 100 200 300 400 500 600 700 -- -- 1200 HL HM HN HO HP JL JM -- -- 1100 HQ HR HS HT HU JQ JR -- -- 1000 HV HW HX HY HZ JV JW -- -- 900 NA NB NC ND NE OA OB -- -- 800 NF NG NH NJ NK OF OG OH -- -- 700 NL NM NN NO NP OL OM ON -- -- 600 NQ NR NS NT NU OQ OR OS -- -- 500 -- -- NW NX NY NZ OV OW OX -- -- 400 -- -- SB SC SD SE TA TB TC -- -- 300 -- -- SG SH SJ SK TF TG TH -- -- 200 -- -- SM SN SO SP TL TM TN -- -- 100 SQ SR SS ST SU TQ TR TS -- -- 0 SV SW SX SY SZ TV TW -- -- Within each 100,000m square, the grid is further subdivided into 1000m -- squares. These 1km squares are shown on Ordnance Survey 1:25000 and -- 1:50000 mapping as the main grid. To reference a 1km square, give the -- easting and then the northing, e.g. TR2266. In this example, TR -- represents the 100,000m square, 22 represents the easting (in km) and -- 66 represents the northing (in km). This is commonly called a -- four-figure grid reference. -- -- When providing local references, the 2 characters representing the -- 100,000m square are often omitted. module OSRef data OSRef OSRef :: Double -> Double -> Datum -> OSRef -- | The easting in metres relative to the origin of the British National -- Grid. [easting] :: OSRef -> Double -- | The northing in metres relative to the origin of the British National -- Grid. [northing] :: OSRef -> Double [datum] :: OSRef -> Datum data Precision -- | A six-figure representation this OSGB grid reference i.e XY123456 SixDigits :: Precision -- | A eight-figure representation this OSGB grid reference i.e XY12345678 EightDigits :: Precision scaleFactor :: Double falseOriginLatitude :: Double falseOriginLongitude :: Double falseOriginEasting :: Double falseOriginNorthing :: Double -- | Create a new Ordnance Survey grid reference using a given easting and -- northing. The easting and northing must be in metres and must be -- relative to the origin of the British National Grid. mkOSRef :: Double -> Double -> Except String OSRef -- | Take a string formatted as a six-figure OS grid reference (e.g. -- TG514131) and create a new OSRef object that represents that -- grid reference. The first character must be H, N, S, O or T. The -- second character can be any uppercase character from A through Z -- excluding I. mkOSRef' :: String -> Except String OSRef -- | Convert latitude and longitude into an OSGB (Ordnance Survey of Great -- Britain) grid reference. toOSRef :: LatLng -> Except String OSRef getOsRefWithPrecisionOf :: Precision -> OSRef -> String evalOsRef :: Double -> Double -> Double -> String -- | Convert this OSGB grid reference to a latitude/longitude pair using -- the OSGB36 datum. Note that, the LatLng object may need to be -- converted to the WGS84 datum depending on the application. toLatLng :: OSRef -> Except String LatLng -- | Validate the easting. evalEasting :: Double -> Except String Double -- | Validate the northing. evalNorthing :: Double -> Except String Double instance GHC.Show.Show OSRef.OSRef instance GHC.Classes.Eq OSRef.OSRef -- | To represent a Universal Transverse Mercator (UTM) reference. module UTMRef data UTMRef UTMRef :: Double -> Double -> Char -> Int -> Datum -> UTMRef -- | Easting [easting] :: UTMRef -> Double -- | Northing [northing] :: UTMRef -> Double -- | Latitude zone character [latZone] :: UTMRef -> Char -- | Longitude zone number [lngZone] :: UTMRef -> Int [datum] :: UTMRef -> Datum -- | Create a new UTM reference object. Checks are made to make sure that -- the given parameters are roughly valid, but the checks are not -- exhaustive with regards to the easting value. Catching an exception -- does not necessarily mean that the UTM reference is well-formed. This -- is because that valid values for the easting vary depending on the -- latitude. mkUTMRef :: Double -> Double -> Char -> Int -> Except String UTMRef -- | Convert this UTM reference to a latitude and longitude. toLatLng :: UTMRef -> Except String LatLng -- | Convert latitude and longitude to a UTM reference. If an attempt is -- made to convert a LatLng that falls outside the area covered by the -- UTM grid. The UTM grid is only defined for latitudes south of -- 84°N and north of 80°S. toUTMRef :: LatLng -> Except String UTMRef -- | Work out the UTM latitude zone from the latitude. getUTMLatitudeZoneLetter :: Double -> Char instance GHC.Show.Show UTMRef.UTMRef -- | To represent a Military Grid Reference System (MGRS) reference. -- -- Military Grid Reference System (MGRS) -- -- The Military Grid Reference System (MGRS) is an extension of the -- Universal Transverse Mercator (UTM) reference system. An MGRS -- reference is made from 5 parts: -- -- UTM Longitude Zone This is a number indicating which UTM longitude -- zone the reference falls into. Zones are numbered from 1 (starting at -- 180°W) through 60. Each zone is 6° wide. -- -- UTM Latitude Zone Latitude is split into regions that are 8° -- high, starting at 80°S. Latitude zones are lettered using C -- through X, but omitting I and O as they can easily be confused with -- the numbers 1 and 0. -- -- 100,000m Square identification Each UTM zone is treated as a square -- 100,000m to a side. The 50,000m easting is centred on the centre-point -- of the UTM zone. 100,000m squares are identified using two characters -- - one to identify the row and one to identify the column. Row -- identifiers use the characters A through V (omitting I and O again). -- The sequence is repeated every 2,000,000m from the equator. If the UTM -- longitude zone is odd, then the lettering is advanced by five -- characters to start at F. Column identifiers use the characters A -- through Z (again omitting I and O). -- -- Easting and northing Each 100,000m grid square is further divided into -- smaller squares representing 1m, 10m, 100m, 1,000m and 10,000m -- precision. The easting and northing are given using the numeric row -- and column reference of the square, starting at the bottom-left corner -- of the square. -- -- MGRS Reference Example 18SUU8362601432 is an example of an MGRS -- reference. '18' is the UTM longitude zone, S is the UTM -- latitude zone, UU is the 100,000m square identification, -- 83626 is the easting reference to 1m precision and 01432 is the -- northing reference to 1m precision. -- -- MGRSRef Methods are provided to query an MGRSRef object for its -- parameters. As MGRS references are related to UTM references, a -- {link MGRSRef#toUTMRef() toUTMRef()} method is provided to convert -- an MGRSRef object into a {link UTMRef} object. The reverse -- conversion can be made using the {link #MGRSRef(UTMRef) -- MGRSRef(UTMRef)} constructor. MGRSRef objects can be converted to -- {link LatLng LatLng} objects using the {link -- MGRSRef#toLatLng() toLatLng()} method. The reverse conversion is made -- using the {link LatLng#toMGRSRef() LatLng.toMGRSRef()} method. -- Some MGRS references use the Bessel 1841 ellipsoid rather than the -- Geodetic Reference System 1980 (GRS 1980), International or World -- Geodetic System 1984 (WGS84) ellipsoids. Use the constructors with the -- optional boolean parameter to be able to specify whether your MGRS -- reference uses the Bessel 1841 ellipsoid. Note that no automatic -- determination of the correct ellipsoid to use is made. -- -- Important note: There is currently no support for MGRS references in -- polar regions north of 84°N and south of 80°S. There -- is also no account made for UTM zones with slightly different sizes to -- normal around Svalbard and Norway. module MGRSRef data MGRSRef MGRSRef :: Int -> Int -> Char -> Char -> Int -> Char -> Precision -> Bool -> Datum -> MGRSRef [easting] :: MGRSRef -> Int [northing] :: MGRSRef -> Int [eastingId] :: MGRSRef -> Char [northingId] :: MGRSRef -> Char [utmZoneNumber] :: MGRSRef -> Int [utmZoneChar] :: MGRSRef -> Char [precision] :: MGRSRef -> Precision [isBessel] :: MGRSRef -> Bool [datum] :: MGRSRef -> Datum data Precision -- | precision of 1m M1 :: Precision -- | precision of 10m M10 :: Precision -- | precision of 100m M100 :: Precision -- | precision of 1000m (1km) M1000 :: Precision -- | precision of 10000m (10km) M10000 :: Precision -- | Northing characters northingIds :: [Char] -- | Return a String representation of this MGRS reference to 1m, 10m, -- 100m, 1000m or 10000m precision. showWithPrecision :: MGRSRef -> Precision -> String -- | Create a new MGRS reference object from the given UTM reference. It is -- assumed that this MGRS reference represents a point using the GRS -- 1980, International or WGS84 ellipsoids. It is assumed that the UTMRef -- object is valid. toMGRSRef :: UTMRef -> Bool -> MGRSRef mkMGRSRef :: Int -> Int -> Char -> Char -> Int -> Char -> Precision -> Bool -> Except String MGRSRef -- | Create a new MGRS reference object from the given String. Must be -- correctly formatted otherwise an IllegalArgumentException will be -- thrown. mkMGRSRef' :: String -> Except String MGRSRef -- | Convert this MGRS reference to an equivelent UTM reference. toUTMRef :: MGRSRef -> Except String UTMRef instance GHC.Classes.Eq MGRSRef.MGRSRef instance GHC.Classes.Eq MGRSRef.Precision instance GHC.Enum.Enum MGRSRef.Precision instance GHC.Show.Show MGRSRef.MGRSRef module DMS data LatitudeDMS -- | Latitude is north of the equator. North :: DMS -> LatitudeDMS -- | Latitude is south of the equator. South :: DMS -> LatitudeDMS data LongitudeDMS -- | Longitude is east of the prime meridian. East :: DMS -> LongitudeDMS -- | Longitude is west of the prime meridian. West :: DMS -> LongitudeDMS data DMS DMS :: Double -> Double -> Double -> DMS [degrees] :: DMS -> Double [minutes] :: DMS -> Double [seconds] :: DMS -> Double toLatLng :: LatitudeDMS -> LongitudeDMS -> Datum -> Except String LatLng