Skip to content Skip to footer

Our maps and data

Converter Tool

The National Grid Converter tool converts Ordnance Survey grid references into pairs of coordinates. Two versions of the National Grid Converter are available: one for use with Windows and one for use on a UNIX platform. The National Grid Converter is available free to Digimap users.

Files of coordinate pairs are useful as they can be easily geocoded by a GIS into a data layer of points.

Precision

Grid references show a range of precisions, all of which can be processed by the converter into coordinates (given in metres).

Grid Reference Precision
TA 100 km by 100 km square
TA04 10 km by 10 km square
TA04SW 5 km by 5 km square
TA0343 1 km by 1 km square
TA0343SW 500m by 500m square
TA034434 100m by 100m square
TA03434340 10m by 10m square
TA0343543405 1m by 1m square

How to use the National Grid Converter (Windows)

1. Download the converter tool

To download the NGConv.exe file simply right click on the link below and save it to your computer in a suitable location (e.g. C:\NGConv).

2. Activate the tool

  • Double click on the icon in Windows Explorer or from the Run prompt in the start menu.
  • If you have a list of grid references in a text file, this can be dragged and dropped onto the desktop icon as explained below. The converter can output a range of coordinates for each grid square depending on the options selected.

3. Converting single Grid References

  • To convert a grid reference to a coordinate pair double click on the NGConv.exe icon; a DOS prompt should open as shown in figure 1.
  • Type in your grid reference and press return to get the coordinates of the southwest corner of the square. Your new coordinate pair is given in metres.

Figure 1 Figure 1: DOS Interface.

The grid reference TA034434 has been entered and the coordinates 503400, 443400 have been returned.**

Coordinates for a different corner

If you require coordinates for a different corner of the grid square or for its centre?

  • Start the program from the Run prompt in the start menu as shown in Figure 2.
  • To do this you need to know the location of NGconv.exe i.e. its file path.
  • Type the file path followed by NGconv and the options that you want. For example:

The command displayed in Figure 2:

  1. accesses the converter from a folder called ngc on the D drive;
  2. it also sets up the converter to return the coordinates from the centre or mid point of the square defined by the grid reference.

Figure 2: Run Interface Figure 2- Run interface.

There are several other point options outlined below:

  • -point=sw returns the coordinates for the southwest corner
  • -point=nw returns the coordinates for the northwest corner
  • -point=ne returns the coordinates for the northeast corner
  • -point=se returns the coordinates for the southeast corner
  • -point=mid returns the coordinates for the midpoint
  • -point=swne returns the coordinates for both corners

By starting the converter with one of these options all the coordinates generated in that session will be for the point specified in the command. The converter will look exactly the same as the one started by double clicking the icon but will produce results dependent on the options set.

4. Converting Multiple Grid References

  • To convert a list of grid references they should be saved as a text (.txt) file with each grid reference on a new line.
  • Drag the icon and drop it on to the NGConv.exe icon and a comma separated value file (.csv) file containing a list of coordinates for the southwest corner will be created.
  • The csv file is automatically created in the same file as the source text file and given the same name with an additional _en appended to it as shown in Figure 3 below:

Figure 3: Dragging and dropping the gridref.txt icon on the NGconv.exe icon will create the gridref_en.csv file. Figure 3

To change these default settings the converter will need to be started from the Run prompt in the start menu. To do this you need to know the location of NGconv.exe (its file path). It also helps to store your text file of grid references (gridref.txt in this example) in the same folder as the NGConv application is stored. Type the file path followed by NGconv and the options that you want, then the name of the text file containing the list of grid references.

For example: D:\ngc\ngconv -includengr gridref.txt

This command:

  1. Accesses the converter from a folder called ngc on the D drive;
  2. It will also set up the converter to include the grid references in the csv file with the coordinates.
  3. The grid references will be read from the file gridref.txt which is in the same folder as the converter.

As well as varying the point to output as outlined in the single grid reference section above there are other options available when outputting data to a csv file.

  • -includengr includes the original grid references in the file
  • -o allows you to specify the name of the output file
  • ==

These options can be used in conjunction with each other or with the point modifiers listed above in the single grid reference conversion section. It is also possible to specify files to convert and to output to that are not in the same folder as the converter.

For example:

D:\ngc\ngconv -o coords.csv D:\ngc\textfiles\gridref.txt

This command will:

  1. run the converter from the folder ngc;
  2. it will use gridref.txt from the textfiles folder;
  3. and will create a new coordinates file called coords.csv in the ngc folder.

Note: You must specify full pathnames for the files. If you specify a path for the input file and you want to change the name of the output file you need to specify a path name for this too to avoid it being placed in the same folder as the converter.

How to use the National Grid Converter (UNIX)

1. Download the National Grid Converter

The National Grid Converter is available free to Digimap users as a PERL script. To download the NGConv.pl file simply right click on the link below and save it to your computer in a suitable location.

2. Run the convertor

  • To run the PERL version of the converter your UNIX machine must have a version of PERL installed.
  • Create a directory and download the NGconv.pl file from the Digimap help pages.
  • Make the file executable with the command: chmod 755 NGconv.pl

The converter can be used for quick queries, converting grid references as they are typed in at the prompt. It is also possible to use the converter to produce files of coordinates from lists of grid references.

Usage options

For usage options enter: NGconv.pl -help,

This will generate the information shown in Figure 4 below:

Figure 4: Usage options. Figure 4

  • If perl is not located at /usr/bin/perl but is in the path then it can be run as: perl NGconv.pl -help
  • You will need to type perl before running the converter at all times.

3. Converting single Grid References

To convert a grid reference to a coordinate type: NGconv.pl

You will be prompted for a grid reference and the coordinate pair will be returned once you enter it as shown in Figure 5.

Figure 5: UNIX Interface, here the grid reference TA034434 has been entered and the coordinates 503400, 443400 have been returned Figure 5

Point options

To vary the point for which the converter produces coordinates you can start the converter with one of the point options outlined below:

  • -point=sw returns the coordinates for the southwest corner
  • -point=nw returns the coordinates for the northwest corner
  • -point=ne returns the coordinates for the northeast corner
  • -point=se returns the coordinates for the southeast corner
  • -point=mid returns the coordinates for the midpoint
  • -point=swne returns the coordinates for both corners

4. Converting Multiple Grid References

The converter can be used to convert lists of grid references to coordinates if they are saved as a text (.txt) file with each grid reference on a new line.

To convert the file you need to specify its name and location when starting the converter e.g. this example would read the gridref.txt file from the textfiles folder.: NGconv.pl textfiles\gridref.txt

  • By default the grid references will be converted into coordinate pairs in a .csv file.
  • The csv file is automatically created in the same folder as the source text file and given the same name with an additional _en appended to it, gridrefs_en.csv in this example.
  • While the file is being written the entries are displayed on screen by default. For larger files it may be best to set the option -v so only a dot is displayed for each grid reference converted. Using -vv will display the grid reference and the coordinate pairs for each conversion.

Figure 6: Working display options

Add grid references to your file

To add the grid references into the .csv file as an initial value before the coordinate pair, use the option: -includengr

Figure 7 shows the difference between two .csv files created with and without the -includengr option.

Figure 7: .csv files created without (left) and with (right) the -includengr option.

Specify output file name

The option -o allows you to specify a name for the output file. You can also specify a path for the file placing it in a different folder from the text file.

All these options can be used in conjunction with each other e.g.: NGconv -v -o csvfiles\coords.csv textfiles\gridref.txt

In the example the above:

  1. Grid references would be read from a file called gridref.txt in the text files folder;
  2. The coordinate pairs would be written into a file called coords.csv in the csvfiles folder.
  3. Only a series of dots would be written to the screen to indicate how many grid references had been converted.