1Geodesy: module 2{ 3 PATH: con "/dis/math/geodesy.dis"; 4 5 # easting, northing in metres 6 Eano: adt{ 7 e: real; 8 n: real; 9 }; 10 11 # latitude, longitude in radians 12 Lalo: adt{ 13 la: real; 14 lo: real; 15 }; 16 17 # datums 18 # WGS84 and ITRS2000 effectively the same 19 OSGB36, Ireland65, ED50, WGS84, ITRS2000, ETRS89: con iota; 20 21 # transverse Mercator projections 22 Natgrid, IrishNatgrid, UTMEur, UTM: con iota; 23 24 # call first 25 # d specifies the datum (default WGS84) 26 # t specifies the transverse Mercator projection (default Natgrid) 27 # z specifies the UTM zone if relevant (default 30) 28 # calls format below 29 init: fn(d: int, t: int, z: int); 30 31 # alters the current datum, transverse Mercator projection and UTM zone 32 # use a negative value to leave unaltered 33 format: fn(d: int, t: int, z: int); 34 35 # OS string to (easting, northing) and back 36 # formats XYen, XYeenn, XYeeennn, XYeeeennnn, XYeeeeennnnn or 37 # formats eenn, eeennn, eeeennnn, eeeeennnnn, eeeeeennnnnn 38 os2en: fn(s: string): (int, Eano); # returns (0, ...) if bad string format 39 en2os: fn(en: Eano): string; 40 41 # latitude/longitude string to (latitude, longitude) and back 42 # format latitude longitude 43 # formats deg[N|S], deg:min[N|S], deg:min:sec[N|S] for latitude 44 # formats deg[E|W], deg:min[E|W], deg:min:sec[E|W] for longitude 45 str2lalo: fn(s: string): (int, Lalo); # returns (0, ...) if bad string format 46 lalo2str: fn(lalo: Lalo): string; 47 48 # general string to (easting, northing) 49 # OS grid or latitude/longitude format as above 50 str2en: fn(s: string): (int, Eano); # returns (0, ...) if bad string format 51 52 # (easting, northing) to (latitude, longitude) and back 53 en2lalo: fn(en: Eano): Lalo; 54 lalo2en: fn(lalo: Lalo): Eano; 55 56 # approximate transformations between any of OSGB36, WGS84, ITRS2000, ETRS89 57 datum2datum: fn(lalo: Lalo, f: int, t: int): Lalo; 58}; 59