Creating contour lines from a ASCI-file

07-19-2011 06:13 AM
New Contributor
Hello to everyone in the forum,

my problem is like this: i´ve got a ASCI-file with values for the x-, y- and z-value (in Gauss-Krueger). Now I would liek to use a converting tool from rhe Toolbox to create contour lines from my ASCI-file. If possible I would like them to be in Vector format.

I appreciate any kind of help.

Thanks in advance
Tags (1)
0 Kudos
5 Replies
Esri Notable Contributor
Here's a workflow you may want to consider:

  • Run the ASCII to Raster GP tool (Conversion toolbox)

  • If you have Spatial Analyst, run the Contour GP tool to create contours. (SA toolbox - Surface toolset)

What you may discover is that the Contour tool will create stairstep contour lines.  To resolve this, run the FocalStats tool with a MEAN Statistics type and a default 3x3 rectangle neighborhood after you run the ASCII to Raster GP tool and then run the Contour GP tool.  This will create smoother contour lines.


Robert LeClair
0 Kudos
New Contributor
Thanks Robert,

sound´s promising.

Another thing: does my ASCI-file need a headline? What do you recommend?
Do the x-, y- and z-values need to be separeted by comma or by something else?

Thanks again for your help
0 Kudos
Esri Notable Contributor
No, I don't believe so.  From the Help:

The structure of the ASCII file consists of header information containing a set of keywords, followed by cell values in row-major order.

There are two variations of the structure of the ASCII file. One identifies the origin by the coordinates of the lower left corner of the lower left cell, or as the center of the lower left cell.

The format of the file in general is:

    NCOLS xxx
    NROWS xxx
    CELLSIZE xxx
    row 1
    row 2
    row n
The definitions of the keywords are as follows:

NCOLS and NROWS are the number of columns and rows in the raster defined by the ASCII file.

XLLCORNER and XLLCORNER are the coordinates of the lower left corner of the lower left cell.

You can also use XLLCENTER and XLLCENTER to specify the origin by the coordinates of the center of the lower left cell.

CELLSIZE is the cell size of the raster.

NODATA_VALUE is the value that is to represent NoData cells.

Cell values should be delimited by spaces. No carriage returns are necessary at the end of each row in the ASCII file. The number of columns in the header is used to determine when a new row begins.

An example of an ASCII raster file is:

    NCOLS 480
    NROWS 450
    XLLCORNER 378922
    YLLCORNER 4072345
    NODATA_VALUE -32768
    43 2 45 7 3 56 2 5 23 65 34 6 32 54 57 34
    35 45 65 34 2 6 78 4 2 6 89 3 2 7 45 23 5 ...

Good luck!

Robert LeClair
0 Kudos
New Contributor
Hi Robert,

thanks again for all your commitment. I really appreciate your help. If I may I would like to bother you with one final question:
My situation has changed slightly: now I´ve been given a *.xyz-file. If I open it for example with Textpad is shows 4 columns. Teh first one contains the ID, the second one the x-value, the third one the y-value and the last one the z-value. 
Is the tool 3D Analyst Tool/Convert/From file/3D-ASCII to feature class somehow useful for my purposes or is my search for solving my problem completely misdirected.

Thanks again
0 Kudos
Esri Regular Contributor
The Ascii 3d to Feature creates a point file not a raster, so you will have to then either interpolate the point file or convert directly to a raster with the point to raster tool, to have a raster that contours can be generated on. 

The Ascii to 3d Feature should work on your .xyz data.  Bear in mind the output selected, if you select the multipoint and then try to evaluate the results created, then the points will be aggregated into sections. Depending on the amount of xyz points, you maybe be better off following the lidar workflows outlined here and create Terrains.
0 Kudos