The NTv2 (National Transformation Version 2) file standard was developed by the "Department of Natural Resources of Canada" in the middle nineties.
Using NTv2 grid files it is possible to transform geodata from one coordinate reference system to another with very high accuracy.
An NTv2 file contains one or more quasi-rectangular grids with shift values which are defined in the NTv2 headers.
NTv2 files are available in ASCII and binary formatted variants.
The ASCII variant is generated during the development phase of the NTv2 file, whereby all header and grid entries can be read and edited with a word processing program as plain text.
For productive use in geodetic software and in GIS, the much faster binary variant with the same content is used.
The program NTv2Tools provides digital tools for developing and processing NTv2 files in binary and ASCII formats.
NTv2Tools analyzes NTv2 files and outputs detailed information on the screen, in graphics files and in text files. The analyzes include the textual representation of the NTv2 header and all grid headers, the graphical representation of all NTv2 grids, the graphical representation of the NTv2 activity scopes including the Polygonal Validity Scopes and the graphical representation of the shift ranges and shift directions.
The program allows conversions between the binary and ASCII formatted variants of the NTv2 files. Furthermore, areas with all contained grids can be extracted from NTv2 files and swapped out to new NTv2 files. This resolves the known issues with oversized NTv2 files. For the export and import of NTv2-grids are further tools available in the program NTv2Tools. Single grids of an NTv2 file can be exported to a new NTv2 file, and single grids of an NTv2 file can be imported into an existing NTv2 file.
On the right the surface of the NTv2Tools program with the various processing options is shown as a screenshot. Please click on this image and on the images shown in the following text, so that they will be enlarged for a closer look.
Fig. 1 The following processings are possible:
NTv2 files that have been previously equipped with Polygonal Validity Scopes to map a polygonal boundary instead of a quasi-rectangular area in the NTv2 grids are supported by the NTv2Tools program.
The Polygonal Validity Scopes realized in the NTv2 files are taken into account for all types of processing and is displayed in all graphical views.
Polygonal Validity Scopes can be realized with the program NTv2Poly or with the Geodetic Development Kit GeoDLL by KilletSoft in any NTv2 files.
Analyzing NTv2 files
Fig. 2 This tool can analyze NTv2 binary and NTv2 ASCII files. After starting the analysis, the header information of the selected NTv2 file and the information about all grids of the NTv2 file are displayed in a text field. If there were found are any errors in the NTv2 file, they are listed in the text box.
The image on the left shows the upper part of the analysis result of a Canadian NTv2 file used as an example in the following text. The output is similar to the file header and grid headers as stored in NTv2 ASCII files.
In the file header the information about the reference systems are listed, between which can be transformed using this of NTv2 file. Here the semi-axes of the earth ellipsoids matching the reference systems are listed. Also the number of grids included in the NTv2 file is listed in the file header. Further information contained in the file header is necessary for the transformation process.
Each grid in turn has its own grid header. Therein the boundaries of the grids and their mesh sizes, as well as the memberships to parent grids and the numbers of available grid meshes are listed. The information of all grids with their creation and modification dates are numbered in the order of their positions in the NTv2 file. They are listed one after the other in the text field.
The numbers of the grids listed here can be used with the below described program options for exporting and importing of NTv2-grids.
Displaying NTv2 grids
Fig. 3 This tool displays the outlines of all grids contained in the selected NTv2 grid file as dark red rectangles with hatching in different bright red colors. At the bottom of the window the geographical coordinates at the mouse pointer and the number of grids contained in the NTv2 file are shown.
An NTv2 file contains one or more grids that can be nested next to or above each other. In order to achieve higher accuracies for certain areas, for example in metropolitan areas, NTv2 grids with smaller and therefore more precise grid meshes can be arranged on underlying parent grids.
The image shows the 114 grids of an NTv2 file of whole Canada. On four basic grids arranged side by side with large mesh sizes many small grids with small mesh sizes are placed. These provide very accurate transformation values for Canadian cities and metropolitan areas.
Displaying NTv2 activity scopes (normal and polygonal)
Fig. 4 The activity scopes of all grids contained in the NTv2 grid file are displayed here in different shades of blue. If the NTv2 file contains Polygonal Validity Scopes, only the grid meshes of the available polygonal areas are displayed, otherwise all grid meshes of the quasi-rectangular grid areas are displayed. Up to a certain threshold the outlines of the grid meshes are highlighted in dark blue color. At the bottom of the window the geographical coordinates at the mouse pointer, the number of grids contained in the NTv2 file and the number of grid meshes are shown. The grid outlines of all grids contained in the NTv2 grid file are displayed as red rectangular borders.
Fig. 5 Depending on the selected NTv2 file, the building of the graphic may take some time, because a test calculation is performed for each grid mesh. This makes possible to detect defective grid meshes.
The image on the left shows the 114 activity scopes with more then 862 thousand grid meshes of the NTv2 file across Canada. Here also four basic grids arranged side by side with many small grids on top are depicted. The image on the right shows the same NTv2 file with Polygonal Validity Scopes. The number of effective grid meshes here is reduced to 644 thousand. It can be seen that the activity scope is limited by the borders of Canada. Thus, grid meshes outside the country boundaries can be excluded from calculations in coordinate transformations with a hint about their invalidity.
Displaying NTv2 shift ranges and shift directions
Fig. 6 The shift range is the numerical difference between the source reference system and the target reference system at a coordinate point. The shift range is calculated from the shifts of the latitude and the longitude as an absolute value in geographical seconds according to the theorem of the Pythagoras. For the graphical representation, the shift ranges for all grid meshes contained in the NTv2 file are calculated and assigned to the rainbow colors. The smallest shift range occurring in the NTv2 file is given the color blue, the largest shift range is given the color red. All intermediate shift ranges are evenly spread with increasing size over the rainbow colors from blue to turquoise, green, yellow, orange to red. The graphical representation of all colored grid meshes gives a clear image of the shift ranges over the entire effective scope of all grids in the NTv2 file. In the lower part of the graphic, a color scale is displayed, which shows the assignment of the shift ranges in geographical seconds to the rainbow colors.
The shift direction is the geographical angle that occurs between a coordinate point of the source reference system and the same point in the target reference system. The shift directions are displayed as vectors in a raster over the activity scope of the NTv2 grids. Each vector represents the direction and the amount of the shifting at a coordinate point shown as a small circle. This provides a good overview of geographic relationships between the source and target reference systems fixed in the NTv2 file.
If the NTv2 file contains Polygonal Validity Scopes, only the grid meshes of the available polygonal areas are displayed, otherwise all grid meshes of the quasi-rectangular grid areas are displayed.
The image above shows the Polygonal Validity Scopes of the NTv2 file across Canada with the shift ranges and shift directions. It can clearly be seen that the shift ranges increase to the northwest. The shift directions rotate from west to east by almost 180 degrees.
Converting NTv2 ASCII files to NTv2 Binary files
For the ASCII version of NTv2 files the extension ".gsa" is used, what means "Grid Shift ASCII". The productive usable binary NTv2 files have the extension ".gsb" which stands for "Grid Shift Binary". The ASCII version is used during the development phase of an NTv2 file because all components then can be assembled with a word processor.
This tool converts NTv2 ASCII files (.gsa) to NTv2 binary files (.gsb). After the selection of the NTv2 ASCII file and the definition of a file name for the new NTv2 binary file, the conversion can be started. In the text field the headers of the NTv2 ASCII file and the new NTv2 binary file are displayed.
Converting NTv2 Binary files to NTv2 ASCII files
Sometimes it makes sense to convert a binary file back to an NTv2 ASCII file. This has the advantage that the file then can be read and edited in plain text using a word processing program.
This tool converts NTv2 binary files (.gsb) to NTv2 ASCII files (.gsa). After the selection of the NTv2 binary file and the definition of a file name for the new NTv2 ASCII file, the conversion can be started. In the text field the headers of the NTv2 binary file and the new NTv2 ASCII file are displayed.
Extracting areas with all grids from NTv2 files
Fig. 7 This tool can be used to extract an area defined by coordinates from a large NTv2 file and place it in a new NTv2 file of smaller size considering all the included NTv2 grids. The coordinate window for the clipping is determined by entering geographical coordinates in the bounding boxes "West", "North", "East" and "South". After selecting the source file in binary format and specifying a filename for the new NTv2 binary file in which the clipping will be saved, the extraction can be started. The following information is displayed in the text field:
The image on the right shows a clipping of the above shown NTv2 file with Polygonal Validity Scopes from Canada.
The clipping contains only 15 grids with 411 thousand of originally 644 thousand grid meshes.
It can be seen that the Polygonal Validity Scopes are also applied to the smaller grids.
Recently NTv2 files with very high accuracy in the centimeter range have been developed, which are suitable for the transformation of geodata of real estate cadastre. The high point density required for this leads to a large number of grid meshes in the NTv2 files. As a result, the file sizes of some NTv2 grid files are enormous. NTv2 files larger than 3 gigabytes are known.
The use of such large NTv2 files is a new trend that developers of geodetic software and GIS could not anticipate. Thus it is not surprising that the NTv2 file BY-KanU.gsb by the German Federal State Bavaria with a lot of software products can not be used. Here, the file size exceeds the by "long integer" addressable file range of about 2,2 gigabytes. Often the grids of the NTv2 file are held in memory due to the calculation speed. However, this is usually not possible with such large grids. These problems can be eliminated only with a great development effort and require a certain changeover time.
This tool allows copying a required area from a large NTv2 file by defined corner coordinates. The separated area is placed in a new NTv2 file that is much smaller than the original. Thereby all grids whose area intersects the given area are taken into account. The newly generated NTv2 file now can be used as usual in all geodetic programs and GIS.
If, for example, only the Munich area is needed for coordinate transformation using NTv2, with the tool it can be cut out from the Bavarian NTv2 file BY-KanU.gsb by defining the corner coordinates of the area of Munich. In a test, conducted by KilletSoft, the resulting NTv2 file only had the 120th part of the original file size.
Exporting NTv2 grids from NTv2 source files
This tool can be used to export the NTv2 grid with a specific position from a binary NTv2 source file into a new binary NTv2 target file. The file header of the source file is copied to the target file. There the number of grids NUM_FILE is set to "1" and the name of the parent grid is set to "NONE". Behind the file header, the exported grid with the grid header and the grid data is copied. The result is a new NTv2 file with only one grid.
The number of the grid to be exported can be determined with the tool "Analyze NTv2 file". After selecting the source file in binary format and specifying a filename for the new NTv2 binary file, in which the export grid is to be saved, the export can be started. The following informations are displayed in the text field:
Importing NTv2 grids into NTv2 target files
This tool can be used to import the NTv2 grid with a specific position from a binary NTv2 source file into an existing NTv2 binary target file. The number of grids NUM_FILE is increased by 1 in the file header of the target file. The position of the grid within the target file is automatically determined according to the NTv2 rules. The grid to be imported is written with the grid header and the grid data at the automatically determined position. If necessary, the name of the grid SUB_NAME and the name of the parent grid PARENT are updated in the grid header.
The number of the NTv2 grid in the source file to be imported can be determined with the tool "Analyze NTv2 file". After selecting the target file in binary format, in which the import grid is to be inserted and selecting the source file in binary format, from which the grid is to be read, the import can be started. The following informations are displayed in the text field:
A backup file is created with the path and the name of the target file and the file extension "sav".
If a file already exists with this file name, it will be overwritten without asking.
Test NTv2Tools without obligation
Detailed information about the program NTv2Tools with geodetic tools can be found on the website https://www.killetsoft.de. There you can also download a free trial version. With the test program you have the opportunity to try all geodetic tools with some included NTv2 files. More options for processing NTv2 files can be found in the descriptions of the products NTv2Poly and GeoDLL on the KilletSoft website.