TRSfile v1.2

by Paul R. Jorgenson - KE7HR

Township, Range, Section, & Meridian file to
Latitude and Longitude file.


TRSfile is a program to deal with large amounts of data that is in the format of Township, Range, Section, Meridian, & State. This information is used to calculate decimal degrees in both Latitude and Longitude.

TRSfile is a Windows program that is based on the program libraries of Martin Wefald. His original work and the DOS program can be seen at his TRS2LL webpage. (Watch out for the Geocities popups!)

TRSfile version is written in Visual Basic and allows the Windows user to have a familiar interface to the program. All input and output can be selected by the mouse and keyboard. Using the TAB key will move logically through the form to the next input box or control. File names for reading and writing data are selected by using standard Windows controls. Users can cut and paste into the form, like other normal Windows programs.

This program covers 17 western states that are described by the program libraries by Martin Wefald. See the coverage and meridian map below.

It is expected that the data input file for TRSfile will be generated by a database program that can write out a comma delimited text file. TRSfile generated a comma delimited text file for the calculated position from the TRS data that can be then read back into the database to update the latitude and longitude fields. Errors are detected and noted in the output files from TRSfile.

TRSfile runs quite fast. For a file with 15,000 data points, a desktop computer with a Pentium 1.6 GHz processor running Windows XP takes about 3 seconds to completely process the data! A laptop computer with a Pentium 133 MHz processor running Windows 95, only takes about 20 seconds to process the same 15,000 lines of data.


Don't need to process large amounts of TRS data from a file? A Windows program to convert individual points from, or to, TRS data interactively is available at TRS2LL for Windows.

Screen Shots and Instructions


TRSfile Opening Screen


Above is the opening screen for the program. The "Status" box tells the user that now is the time to "Select Input File".

Clicking on the "Input File" button brings up a screen similar to that immediately below.


Open input file screen.


This is a standard Windows dialog box to select a program name. Select the data input file name remembering that it might be possible to have to use the normal Windows navigation controls in the dialog to get to the directory which holds the file.

The program looks for data files with the extension .TRS. If needed, use the pulldown labeled "Files of Type" and it will be possible to select from any type of file extension (*.*). TRS files are standard ASCII text files that have been formatted correctly so that TRSfile may use them. The extension .TRS was selected to indicate that the file contains this formatted data.


TRSfile after selecting the input file.


The data file name is displayed in the box next to the "Input File" button. The Status box now directs the user to "Select Output File".

Clicking on the "Output File" button brings up a screen similar to that immediately below.


Select output file screen.


The output file name is typed in or selected in the same manner as the input file. The default file extension for the output file is .OUT. This file is a standard ASCII text file.

TRSfile after selecting input and output files.


Now, both the input and output file names are displayed in their respective boxes and the "Status" box directs the user to "Process!".
A new "Process" button has appeared and should be clicked to start the data conversion.

TRSfile during file processing.


The screen shot above shows the program during the processing of the data file.
The "Status" has changed to "Working! Please Wait!" and the "Process" button has grayed out.

TRSfile after completing file processing.


The screen above shows the program after completing the process. The "Status" shows that the process is "Done!" and the "Process" button has been removed from the form.

File Structure, Input & Output Files


Test input data file, viewed in text editor.


The above screen shot shows a formatted data input file, viewed in a text editor. The format of each line of the data file can be seen. The first line of the file has a header to describe the fields which are separated by commas. There are exactly 10 commas separating 11 data elements in each line of the file. Each line must end with a carriage return line feed (CRLF which is what happens when the 'Enter' key is used on your keyboard). The critical elements of the input file are the State, Meridian, Township, Range, Section, Latitude, Longitude, and Error. All other data elements can be anything since they are just read as they are and then passed to the output file without any processing.

The file header in the example reads:
Type,Number,State,County,Meridian,Township,Range,Section,Latitude,Longitude,Error
but could just as well read:
Field 1,Field 2,State,Field 3,Meridian,Township,Range,Section,Latitude,Longitude,Error

Since the Latitude and Longitude are unknown in the input file, the fields can be left blank (as in this example) or can have zeros in those places. The error field should always be left blank in the input file as this is reserved for the output phase. The example file has a couple of errors which will show up after processing (see the error page graphic below).

State abbreviations are preferred over the complete name for the fact that typographical errors are less likely.

Meridians are specified by the full name or by an abbreviation code. The codes for the meridians are as follows:

The meridian value may be omitted and the calculation will proceed, but with possible unexpected results. It will always be better to specify the meridian. (Not including the meridian is like answering the question about a birthday by saying "Wednesday in February". Maybe only 4 or 5 possibilities but not enough information to be specific.)

Townships are always a number followed by either a N or S. Odd townships that are .5 or .75 must be specified by using the decimal value (ex: 17.5N).

Ranges are always a number followed by either a W or E. Odd ranges that are .5 or .75 must be specified by using the decimal value (ex: 21.5E).

Sections are numbered 1 to 36, in a standard township.


Test output data file, viewed in text editor.


The test data file after processing is shown above. It can be seen that the input and output structure is the same. The calculated fields for the Latitude, Longitude and the Error (if any) are completed. The number of lines in the input file equals exactly the number of lines in the output file. The input data file is not changed in any way during processing. For lines with errors, the calculated data is not presented - the line is left as it was presented in the input file with the Error noted at the end.

The 10th data line has an error and the message "Section out of range (1-36)" is appended to the line in the output file. Section 44 is the 'not valid' data element.

The last data line has an error and the message "Out of Range Error (State, Township, Range, Section, Meridian)" is appended to the line in the output file. This error message is used when general errors occur and the program has a hard time being specific. In this case, inspection of the line reveals that the Range 444E is probably the bad data element. It was probably supposed to be 44E but the "fat finger" struck the data entry person. If the data elements look like they are in the range of possibility, check another authoritative source to see where the error might be. One good authoritative source is the BLM Land Survey Information System website. Another source would be USGS topo maps (or the large number of electronic versions of these maps). From sources such as these, it may be possible to determine that while near state borders that use a common meridian, the data collector entered the wrong state, for instance.

Error codes are as follows:


Test data file "errors only" file, viewed in text editor.


TRSfile automatically generates an error file called TRSerrors.out, which is shown above for the test data. This file only has the data lines which were generating errors. It can be seen that exactly the same error lines from the normal output file are included. This error file gets written over upon new data files being processed. If the error file is desired to be kept, use standard Windows techniques to rename this file. (Better yet, fix the errors in the input file and rerun!)

Coverage Map with Meridians, Typical Township showing Sections


Coverage of TRSfile program, 17 states.
Meridians are color coded.


The above map shows the 17 state coverage of TRSfile. The color coded meridians show their areas of coverage.

NO other states, or parts of states, are expected to be available.


Townships and Ranges count up away from the intersection of the Meridian and the Baseline. Away from this origin point, there are 'corrections' made to compensate for the curvature of the earth, every few townships.

A typical Township has 36 sections which are one square mile each (640 acres). Some sections in the township 'corrections' are not square or 640 acres.
Because the Earth is not flat and the grid system of Township, Range, and Section does not evenly fit on a curved Earth, you need TRSfile to help calculate the latitude and longitude of large numbers of TRS data points.

Program Availability


A zip file with the installation program for TRSfile is available here.

CAUTION Large File! 2.0Mb.

Quite a large number of hours of programming have gone into creating a Windows interface for users to manipulate their volumes of data that would take countless hours of manual conversion. If you find this program useful, please consider making a small donation to the programmers to help compensate for this effort. Email Paul to discuss.


Email Paul at
Paul's Home Page


Last Modified: 18 November 2011