NGRCalc 1.03 - National Grid Calculator ======================================= Original by Len Killip 1997 Updated by J.G.Harston 1999, 2009 mdfs.net/Apps/Mapping/GridRef jgh@mdfs.net 70 Camm Street, Walkley, Sheffield S6 3TR Introduction ------------ NGRCalc is a tool to convert between latitude and longitude and national grid references for locations around the British Isles. It can be run interactively or from the command line. It runs on any platform that can run BBC BASIC, such as BBC, RISC OS, DOS and Windows. A precompiled Windows binary is also supplied. Grid references can be supplied or output as Ordnance Survey of Great Britain (OSGB), Ordnance Survey of Ireland (OSI), Irish Transverse Mercator (ITM) or Universe Tranverse mercator (UTM) Command line ------------ NGRCalc can be used from the command line with the following parameters: NGRCalc [] [ [-osgb -osi -itm -utm]] [-i file] [] Convert to grid reference ------------------------- If a latitude and longitude is given it is converted to a grid reference. By default the conversion is to the OSGB grid, but other grids can be selected with the options. If a comment is given, it is output at the start of the output line. Examples -------- Command: NGRCalc 49,0,0 2,0,0,W Output: XE0000000000 XE00000000 XE000000 XE0000 XE00 XE 400000 -100000 Command: NGRCalc 54,29,30,N 0,37,0,W Whitby Output: Whitby NZ8959411599 NZ89591159 NZ895115 NZ8911 NZ81 NZ 489594 511599 Command: NGRCalc 53,23,0 1,28,0,W Output: SK3547187549 SK35478754 SK354875 SK3587 SK38 SK 435471 387549 Command: NGRCalc 57,35,48 13,41,19,W Rockall Output: Rockall MC0350016580 MC03501658 MC035165 MC0316 MC01 MC -296500 916580 Command: NGRCalc 49,42,0,N 2,12,0,W Alderney Output: Alderney XD8557977833 XD85577783 XD855778 XD8577 XD87 XD 385579 -022167 Command: NGRCalc 49,42,0 2,12,0,W -utm Alderney Output: Alderney WA5771507897 WA57710789 WA577078 WA5707 WA50 WA 557715 507897 Command: NGRCalc 49,13,0,N 2,7,0,W Jersey Output: Jersey XD9150524091 XD91502409 XD915240 XD9124 XD92 XD 391505 -075909 Command: NGRCalc 49,13,0,N 2,7,0,W -utm Jersey Output: Jersey WV6435754208 WV64355420 WV643542 WV6454 WV65 WV 564357 454208 Convert to latitude/longitude ----------------------------- If a grid reference is given - starting with a letter - it is converted to a latitude and longitude. The grid to use is determined from the first letter. If the first letter is 'I', then ITM is used, if 'W', then UTM is used, otherwise OSGB is used. Examples -------- Command: NGRCalc XE0000 Output: 49,0,0,N 2,0,0,W Command: NGRCalc NZ895115 Output: 54,29,26.867,N 0,37,5.305,W Command: NGRCalc SK354875 Output: 53,22,58.426,N 1,28,3.853,W Command: NGRCalc MC03501658 Output: 57,35,48.443,N 13,41,19.32,W Command: NGRCalc XD8577 Output: 49,41,32.975,N 2,12,28.791,W Command: NGRCalc WA5707 Output: 49,41,31.216,N 2,12,36.154,W Command: NGRCalc XD915240 Output: 49,12,57.061,N 2,7,0.22,W Command: NGRCalc WV643542 Output: 49,12,59.771,N 2,7,2.818,W Command: NGRCalc IT1090 Output: 53,11,49.012,N 6,21,11.463,W Input file ---------- The -i option allows a file of input parameters to be passed to NGRCalc. For example, if the file 'input.txt' contains the following: 57,35,48 13,41,19,W Rockall 49,42,0,N 2,12,0,W Alderney XD915240 WV643542 and the command NGRCalc -i input.txt is used, the following will be output: Rockall MC0350016580 MC03501658 MC035165 MC0316 MC01 MC -296500 916580 Alderney XD8557977833 XD85577783 XD855778 XD8577 XD87 XD 385579 -022167 49,12,57.061,N 2,7,0.22,W 49,12,59.771,N 2,7,2.818,W Output file ----------- The output can be redirected, so NGRCalc can be called as an external program to perform calculations, and then hand the results back. For example, with BBC BASIC for Windows, using: OSCLI "cmd /c "+NGRCalc$+" "+latlong$+" > "+outfile$ or in RISC OS, using: OSCLI "WimpTask "+NGRCalc$+" "+latlong$+" { > "+outfile$+" }" calls NGRCalc and leaves the results in the file outfile$ where they can be read back. Versions -------- v1.03 25-Jun-2009 - Works interactively as well as command line on Windows. v1.02 18-Apr-2009 - OSI, ITM, UTM, command line added, J.G.Harston. v1.01 15-Oct-1999 - Updated by J.G.Harston. v1.00 28-Feb-1997 - Original program by Len Killip, G0APZ.