Adding an ASCII or text file table

In ArcGIS, you can directly access data in delimited text files and work with them as tables. ArcCatalog and the Add Data dialog box in ArcMap list files with .txt, .asc, .csv, or .tab extensions and assign them a file type of text file.

Files with a .txt, .asc, or .csv extension are interpreted as comma delimited, while files with a .tab extension are interpreted as tab delimited by default. Any file with one of these extensions will be interpreted as a text file table even if it doesn't contain tabular data. If you attempt to display a text file that doesn't contain tabular data, the software will either produce an error or attempt to display the data as a table. To avoid this problem, give your delimited text files a .csv or a .tab extension. This will help differentiate text files with delimited data from unformatted text files.

The first row of your text file can contain the column headings. The following rows can contain coordinates and attributes. Remember to use commas or tabs to distinguish the columns. The following is an example of a comma-delimited text file:

x,y,ID,color
8.6,5.6,001,blue
99.3,77.0,002,blue and red
8.01,44.3,003,orange

This can be previewed in ArcCatalog or added as data in ArcMap and will appear as shown:

ASCII Table example

How coordinate information is determined

If your delimited text file contains data coordinate information, such as x,y data, ArcGIS will recognize the coordinate information as numeric fields which can be used to either display your information as a layer or as input to tasks, such as geocoding. In the example above, the coordinate information was straightforward and easy to recognize; it was contained in fields called x and y. This won't always be the case and, in many instances, the information you want to use within ArcGIS may be stored in any number of different formats.

If this is the case, such as when the coordinate information is stored within a text field or is stored in degrees, minutes, and seconds (for example, -120 13 58), the information will be converted and displayed to you in Decimal Degrees (DD) for use in ArcGIS. In the case of single-field formats, such as UTM, ArcGIS will maintain the original UTM field but add two additional fields appended with _X and _Y and display the coordinate information in Decimal Degrees. For example, if you have a text field called UTM, when opening the text file, you will see three fields called UTM, UTM_X, and UTM_Y. In the case of double-field fields, such as Lat/Lon, when these fields are identified as text fields, ArcGIS will maintain the original fields and add two new fields to contain the converted Decimal Degree coordinate information. For example, if you have two text fields called Lat and Lon, when opening the text file, you will see four fields called Lat, Lon, Lat _D, and Lon_D. ArcGIS supports numeric information stored within text files in many different formats. A list of them, including a detailed description of the supported notation, is available in Supported Notation Formats.

If you need to display the contents of the text file in a format other than Decimal Degrees, you will need to use the Convert Coordinate Notation tool to convert the coordinate information.

Field names

Field names for ASCII and text files follow the same conventions as field names for geodatabase feature classes. See the Field Names section under Defining fields in tables.

The only character that is not supported is a single double quote. You should edit the field names in delimited text files to remove any single double quotes and either remove them or replace them with another character.

Overriding how text files are formatted

ArcGIS uses its own implementation for accessing delimited text file information and should handle the most common cases for displaying these files in ArcGIS. As opposed to previous releases, schema.ini files, which are used by the Microsoft ODBC Text Driver for storing data description information, are not required for displaying delimited text file information in ArcGIS. However, if a schema.ini is present, ArcGIS will honor the settings specified in a schema.ini file to determine how the text file should be displayed.

There is one instance in which a schema.ini file will be created by ArcGIS when opening a delimited text file: when the format for a certain field cannot be reliably determined. In this case, a schema.ini file will be created containing the presumed format of the field.

If the information in your delimited text files is displaying correctly, you can choose to leave the schema.ini file. If you've had to make modification to the schema.ini file to override how information was displayed, you may want to remove or rename the schema.ini file and test how ArcGIS is handling the information in the delimited text files.

You can override how delimited text files are displayed within ArcGIS by using the schema.ini files. An example of when you would want to use the schema.ini file to override the default behavior is when ArcGIS is misinterpreting a field type. The following example shows how to do this for a field called PLOTS which should be displayed as type Text but is being interpreted as type Double.

[Trees.CSV]
Col14=PLOTS Text

Note that you may need to create a schema.ini file if one is not present and you need to override how delimited text files are displayed in ArcGIS. For more information on the schema.ini file, do a search for schema.ini on the Microsoft MSDN website.

TipTip:

If attribute values are bracketed with special characters like double quotes, the fields will be interpreted as text fields. For numeric fields, make sure that the double quotes are removed.

Related Topics

3/18/2014