Knowledge Base

Back to Terrain Module


Importing ASCII Files

Updated October 18, 2017


This article applies to:
  • Terrain 3D
  • Terrain Forestry
  • RoadEng Civil
  • RoadEng Forestry

Topographic Survey Example

The Terrain Module will accept a variety of different ASCII files by allowing the user to configure the import format. This example illustrates the use of the import functions to read a topographic survey file created by a total station data collector.

A Typical Data File

The file (excerpt below) consists of a sequence number, X, Y, Z and code separated by tabs.

1 329591.7666 2195715.037 1172.736 SPOT

2 329570.0566 2195516.997 1158.295 PP

3 329625.9166 2195555.797 1159.534 SPOT

4 329573.4966 2195594.317 1161.31 SPOT

5 329552.9966 2195554.887 1160.682 SPOT

6 329561.9466 2195602.537 1164.661 SPOT

7 329531.5866 2195563.567 1166.9 SPOT

8 329527.9066 2195628.777 1177.279 SPOT

9 329500.6266 2195578.507 1177.822 SPOT

10 329482.4666 2195641.327 1190.244 SPOT

11 329456.7666 2195598.247 1192.141 SPOT

12 329433.7266 2195654.027 1204.384 SPOT

13 329407.6066 2195614.587 1206.786 SPOT

14 329396.5866 2195673.697 1216.893 SPOT

15 329374.2266 2195630.877 1218.22 SPOT

16 329347.4766 2195697.547 1231.632 SPOT

17 329321.3566 2195653.237 1235.406 SPOT

18 329296.9066 2195704.397 1242.378 SPOT

19 329276.1266 2195665.097 1244.316 SPOT

20 329247.7166 2195711.457 1248.812 SPOT

Figure 1: Excerpt from Survey1.txt

Setting Up an Import Format

  1. File | New.

  1. Setup |Module Setup. Select the Units tab, Units: Imperial (ft). The software cannot detect units from the information in an ASCII file.

  2. Click on the Import tab |Open… button. Browse to find the import options file C:\ProgramData\Softree\Terrain Tutorials\Training\training Normal.iop. Press Open button.

Figure 2: Opening an Import/export Format File from Terrain Setup

  1. Select the format called “ASCII (x,y,z,code)”, then press Add… button to open the Define New File Format Options dialogue as shown in the figure below.

Figure 3: Define New File Format Options Dialogue

Note: When you create a new import format, it will initially be a copy of the one selected when you press the Add… (“ASCII (x,y,z,code)” in this case).

  1. Within the open dialogue box type New ASCII in the Description field and then click on Details to open the next Import ASCII Options Dialogue box shown below.

Figure 4: Import ASCII Options Dialogue – Structure Tab

The Import ASCII Options dialogue box allows you to describe the format of external files. Several options are available to identify, select and format incoming coordinate data. Detailed descriptions of the options in this dialogue box are available by pressing <F1>.

  1. Change the Column Assignments in the dialogue box to match the figure above (X=3, Y=2, Z=4, Code=5, Feature Name=5 and Comment=5). Our file contains [point #, Y, X, Z, code] in each line.

You have now set up the import format to read data from the correct columns in the file.

  1. On the Code tab, you can assign properties, symbols and line-types to the incoming points. Change your default code properties to match those shown in the below figure; 3D points with a black cross symbol.

Figure 5: Import ASCII Options Dialogue – Code Tab

  1. Press Open button, within the existing dialogue and select
    <Terrain>\ASCII Import\survey1.txt. This will extract all the codes found in the file.

  2. Select the CONTROL code found in the codes list. Note that the options initially are the same as DEFAULT. Change the Color: Navy and Symbol: Circle with Cross.

  3. Select EP (Edge Pavement) in the code list and type in * beside EP, eg. ‘EP*’, in the Code Name. The “*” is a wild card – any code starting with “EP” will fall into this category. Make the following changes:

    • Type: Polyline

    • Connected: Connect All by Code

    • Breakline: Yes

    • Color: Blue

    • Symbol: None

Points with the EP code will be connected (in the order found in the file) and made into a blue breakline. The Connect All by Code property ensures that codes like EPL and EPR form separate features even though they both fit the EP* specification.

  1. Select code name CLP (Center Line Pavement) in the code list. Make the following changes:

    • Type: Polyline

    • Connected: Connect All

    • Breakline: Yes

    • Color: Red

    • Line-type: Dash-dot

  2. Go to the top of the dialogue box and select the Structure tab again. Press Features in the Advanced section on the lower right. The dialogue shown in the Figure below will appear.

Figure 6: Feature Detection Method Dialogue Box

The dialogue box above allows you to limit the length of polyline features by defining a termination character to be found in the point code.

An exclamation point, “!”, is defined as the termination character in the Feature Detection Method dialogue box. If you refer to the Survey1.txt (see figure at start of this exercise), you will see many of the point codes end with “!”; this means that a connected feature breaks after this point and a new feature will be created when the next point of this type is encountered. The EP polyline code (defined above) will import as two breaklines (left and right) because of a strategically placed “!” in the survey point codes.

  1. Press Cancel to exit the Feature Detection Method dialogue box.

  2. To test the specification, go to the Test tab (see figure below).

Figure 7: Import ASCII options dialogue – Test Tab.

  1. File | Open <Terrain>\ASCII Import\Survey1.txt.

  2. Press Next Record several times. At the bottom of the dialogue box the values of X, Y, Z and Code are displayed. Confirm that the incoming fields are being correctly interpreted; if not return to the other tabs to modify the format.

  3. When satisfied, press OK to return to the Terrain Setup dialogue box.

  4. To save the new import specifications for future use Save As... But in this case, we won’t. Press OK to close the Terrain Setup dialogue box. Now we’ll use the import format we’ve created to open the survey data file.

Note: Normally, you would choose Normal.IOP and write over it (to update your default settings) – do this only if you are working on a computer used for tutorial or training, otherwise save as training.iop or Cancel to avoid changing your defaults.

  1. File | Open. Change dropdown menu in lower right-hand corner to New ASCII (at the bottom of the list). Open <Terrain>\ASCII Import\Survey1.txt. You will be presented with the Import Options dialogue box to allow last minute changes. Press Open button to import the file.

  2. Softree Warning appears: “Incoming coordinate system and units are undefined. OK to continue without conversion?” Click Continue.

  3. Select View | Screen Layouts, select normal.ilt from the dropdown menu. This will set up your options and windows to look like the figure below.

Figure 8: Plan Window After Importing Survey1.txt.

Note: The right EP feature is selected (note the properties displayed in the status window). Also note that there are many point codes that have not been formatted or connected to form breaklines. In the next steps, we will re-read the same data with a prepared import format.

  1. Turn on the feature labels:

    • Right-click in plan view |Select| All Features

    • Feature Tools | Labels

    • Double-click to turn on ‘Comments (at feature points)’ and ‘Feature Name’. Both should now have black checkmarks next to them.

    • Press OK.

  2. To reduce the size of the labels, zoom in by scrolling with the mouse wheel until the label font size is smaller and readable. Press the Scale Lock button. Now View | Zoom extents. The labels will remain the size of what they were when they were locked.

  3. File | Open. Change Files of type to ASCII 2 (#,y,x,z,code). Open <Terrain>\ASCII Import\Survey1.txt. When prompted to save changes, choose No.

  4. This will open the Import Options dialogue; click on the Code tab to see the extra codes defined – no changes are required. Press OK to import the file. When prompted with the Softree Warning message hit Continue.

This will set up your options and windows to look like the figure below.

Figure 9: Survey1.txt Imported with More Point Codes Defined

  1. You may wish to select features with the mouse to see what properties are displayed in the Status of the Feature Properties panel area.

  2. The status panel on the right hand of the display. To add more attributes, press the gear button at the bottom of the status window then press Add/Remove… button. Select the features you would like to add or remove.

  3. File | New. Do not save changes.

Top