HOW TO

Convert a lattice/grid to x,y,z triplets

Last Published: April 25, 2020

Procedure

How to convert lattice or grid to an ASCII file of x,y,z values.

Answer:

Method 1: The SAMPLE function in GRID will produce an ASCII file with one record for each cell in a grid. The command in GRID is:

outfile = sample(mygrid)

The information listed is the cell_value, x-coord, y-coord. Thus the output of the SAMPLE command is of the format:

z,x,y

The columns can be rearranged in a text editor. This process requires a GRID license.

Method 2: This method requires ArcInfo 7.0.1 or higher. Use the GRIDPOINT command to convert every cell of the grid (except NODATA) to a point in a point coverage. Be sure to specify a pat_item in GRIDPOINT so that the values of the grid cells are written to the PAT. Use ADDXY to add x and y coordinates to the point coverage PAT. These items can be placed into a text file as follows:

Arc: TABLES
Tables: SELECT cover.PAT
Tables: UNLOAD file.txt X-COORD Y-COORD pat_item

Another way to create the text file does not require using ADDXY, but the grid cell values must be integers. Calculate the cover-ID item in the PAT equal to the pat_item, using TABLES or INFO. Run IDEDIT with the POINT option on the coverage. UNGENERATE the coverage using the POINT option. This gives a file of the format z,x,y. The columns may be shuffled with a text editor if needed.

Method 3: If ARC/INFO 7.0.1 or higher is not installed, but a TIN license is available, use VIP with the 100% selection option to convert every cell that is not NODATA in the grid or lattice to a point in a point coverage. Follow the steps in Method 2 to create the text file.

Article ID:000001301

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic