C&G raw data formats
There are two types of C&G raw data files. The .RAW is the old type used by the DOS and CGField software products. The
.CGR file is the new type used by CGSurvey for Windows and CGSurvey for AutoCAD.
.RAW file format:
There are two versions of the .RAW file, a two-byte code and four-byte code file. If the version in the header is ‘3’ it
is a 4 byte code file. If it is ‘2’, it is a two-byte code file.
Version ‘3’:
Record Length of Raw Data File without Description = 69 (67 + 2 for
CR and LF)
The description length can vary from one .RAW file to the next. To find the record length, get the description length
from first record and add 69 to it.
Another way to get the description length is to read the number of bytes through the first LF, and then subtract 69 from
it to get the description length.
Version ‘2’:
Record Length of Raw Data File without Description = 67 (65 + 2 for
CR and LF)
The description length can vary from one .RAW file to the next. To find the record length, get the description length
from first record and add 67 to it.
Another way to get the description length is to read the number of bytes through the first LF, and then subtract 67 from
it to get the description length.
All records (including the header) are the same length. All records end with .
The only non-ASCII value in a raw data file is the description length, which is located in the first (header) record.
Header record:
Field Position Description/Value
in Record
Type record 0 ASCII '0' if header record
Job Name 1 -> 7 Header Job Name (ASCII)
Operator 8 -> 17 Operator Name (ASCII)
Date 18 -> 25 Date (ASCII)
Temperature 26 -> 31 Temperature (ASCII)
Pressure 32 -> 38 Pressure (ASCII)
Des. Len 39 -> 40 Raw data description length
compressed binary integer - 2 Bytes
Version Type 41 for latest version - ASCII '3'
Data records:
Field Position Description/Value
in Record
Type record 0 ASCII '0' if header record
ASCII '1' if Slope Dist / V.Angle
ASCII '2' if H.Dist / V.Dist
ASCII '3' if Reference Bearing
ASCII '4' if Bad Record
ASCII '5' if Scale Factor
ASCII '6' if Comment/Code
Hex '1a' if end of file
Inst Pt 1 -> 6 Inst. Pt. number (ASCII)
H.I. 7 -> 14 Height of Inst. (ASCII)
B.S. Pt. 15 -> 20 B.S. Pt. number (ASCII)
PH 21 -> 28 Rod/Prism Height (ASCII)
Angle 29 -> 38 Horizontal Angle (ASCII)
Distance 39 -> 47 S.Dist/H.Dist (ASCII)
Vertical 48 -> 56 V.Angle/V.Dist (ASCII)
F.S. Pt. 57 -> 62 F.S. Pt. number (ASCII)
4-byte code file:
Code 63 -> 66 Point Code (ASCII)
Desc 67 -> 67+Desc_len Description
2-byte code file:
Code 63 -> 64 Point Code (ASCII)
Desc 65 -> 65+Desc_len Description
All values are right justified in field except the description and point code which are left justified.
If the instrument point field is filled with spaces, the record is a foresight record.
If there is a value in the instrument point field, the record is an instrument record (new setup).
Direction Records:
Record types '3' (Bearing Azimuth Records) are tied to the current instrument setup. It is positive if it is from the
current instrument point to the next instrument point, or negative if it is from the instrument point to the backsight
point. It can either be in bearing or azimuth format. The azimuth is placed in the Horizontal Angle field.
IP HI BS RH HA Dist Vangle
1 1 5.32 5 5.00 0.00000 290.540 88.35000
3 -145.00000
The direction 145 is either N45E or the azimuth 145 depending on the mode, and goes from point 1 to point 5.
1 1 5.32 9 5.00 0.00000 290.540 88.35000
3 145.00000
1 5.00 289.19300 292.310271.25100 2
1 2 5.20 1 5.00 0.00000 292.310 91.31300
The direction 145 is either N45E or the azimuth 145 depending on the mode, and goes from point 1 to point 2.
Scale Records:
Record types '5' (Scale Factor) are placed in the horizontal angle
field.
1 1 5.32 5 5.00 0.00000 290.540 88.35000
5 .999996
Records that start with ‘6’ are either comment records or special coded records.
Coordinate record:
6C 23 1000 1000 900 ‘IPF
Elevation record:
6E 23 900
Traverse Records:
6LT – start a loop traverse
6CT – start a closed traverse that begins and ends on known points
6FS 7 – For CT traverse, this tells the point you are tying into (last fs point, if there are no sideshots at the last
instrument point, this is not necessary).
6OT – start an open traverse
6ET – End traverse
Traverses can be sequential or embedded.
Any record that begins with a ‘4’ is a record marked BAD in the field and should be ignored.
.CGR Files:
The file has a .CGR extension. The .CGR file is an ASCII file.
The Description Length can vary from one .CGR file to the next.
The header record is 500 bytes.
Header record:
Field Position Description/Value
in Record
Job Name 0 -> 14 Header Job Name
Client 16 -> 41 Client Name
Operator 42 -> 62 Operator Name
Date 63 -> 71 Date
Temperature 72 -> 78 Temperature
Pressure 79 -> 86 Pressure
Book 87 -> 97 Field Book
Page 98 -> 108 Field Book Page
Note 109 -> 189 Special Notes
Desc Len 190 -> 194 Length of Description field
Record Len 194 -> 197 Data Record Length
(fixed-length + desc-length + CRLF)
Version 198 -> 209 Version
High Rec 209 -> 218 High record number
219 -> 497 Not used (future expansion)
488 -> 499
Data records:
Field Position Description/Value
in Record
Type record 0 ASCII '1' if Slope Dist / V.Angle
ASCII '2' if H.Dist / V.Dist
ASCII '4' if Bad Record
ASCII '6' if Comment/Code
Hex '1a' if end of file
Inst Pt. 1 -> 11 Inst. Pt. number (alpha-numeric)
H.I. 12 -> 20 Height of Inst.
B.S. Pt. 21 -> 31 B.S. Pt. number (alpha-numeric)
PH 32 -> 40 Rod/Prism Height
Angle 41 -> 51 Horizontal Angle
Distance 52 -> 61 S.Dist/H.Dist
Vertical 62 -> 71 V.Angle/V.Dist
F.S. Pt. 72 -> 82 F.S. Pt. number
Code 83 -> 86 4 Char Point Code
Desc 87 -> 87+Desc_len Description
terminated with
All values are right justified in field except description and Point code which are left justified.
If the instrument point field is filled with spaces, the record is a foresight record.
If there is a value in the instrument point field, the record is an instrument record (new setup).
Special Records:
Special Codes can be placed in the Comment Lines. These codes are the same as the .RAW version (Coordinate, Elevation,
Traverse records) with the following additions.
Scale Record:
6S .999876 (Scale)
Direction Record
6DR 1-3 234.5634 (Direction)
The Direction code in the above example says the direction from point 1 to point 3 is either:
S 34-56-34 E (if in bearing mode)
234-56-34 (if in azimuth mode)
The bearing/azimuth mode is set in the software and is not part of the raw data file.
Standard Error Records:
Standard error values can be placed directly in the raw data file. These records begin with the code “SE”. They are used
to set the standard error values of measurements and control points that will be used in the Network Least Squares
Adjustment program. All angle values are in seconds. These SE records will control until there is another SE record to
change it. They can be placed anywhere in the raw data file and can affect specific measurements. If there is NO SE
record in the raw data file, then the project defaults will control. There are three basic types of Standard Error
records:
Control SE records:
These control the SE values for Coordinate and Direction (azimuth) records. Example:
6SE X:! Y:! Z:! AZ:5
The ! symbol means to hold a value. The # symbol means to let it float. Any other value (.05) is taken as the Standard
error assigned to the value.
Measurement SE records:
These control the SE values for measurements. The following values can be set:
Distance Error, Horizontal Pointing Error, Horizontal Reading Error, Vertical Pointing Error, Vertical Reading Error,
and PPM. Example:
6SE D:.01 PE:5 RE:10 VP:5 VR:10 PPM:5
Setup SE records:
These control the SE values for the equipment setup. The following values can be set: Target Centering Error, Instrument
Centering Error, Instrument Height Error and Prism Height Error. Example:
6SE TE:.001 IE:.001 HI:.01 ROD:.01
The “*” symbol is used to put SE values BACK to the project defaults, example:
6SE X:* Y:* Z:* AZ:*
6SE D:* PE:* RE:* VP:* VR:* PPM:*
6SE TE:* IE:* HI:* ROD:*
Data OFF/ON records:
6DO
Data ON/Off records come in pairs. The first DO record will turn the data OFF. All raw data following the DO record will
be ignored when processed. The second DO record will turn the data back ON. Raw data following the second DO record is
active.