Convert ARC ASCII Text File To Xyz
Convert ARC ASCII Text File To Xyz
html
arcgridread
Read gridded data set in ArcGrid ASCII or GridFloat format
Syntax
[Z,R] = arcgridread(filename)
[Z,R] = arcgridread(filename,coordinateSystemType)
Description
example
Examples
collapse all
[Z,R] = arcgridread('MtWashington-ft.grd');
Display the data as a surface. Add two labels to the display and set the colormap.
mapshow(Z,R,'DisplayType','surface')
xlabel('x (easting in meters)')
ylabel('y (northing in meters)')
demcmap(Z)
View the terrain in 3-D.
axis normal
view(3)
axis equal
grid on
zlabel('elevation in feet')
Input Arguments
collapse all
filename— Name of file containing the grid
character vector
Name of file containing the grid, specified as a character vector. The arcgridread
function supports the following formats.
Format Description
In this format, created by the ArcGIS GRIDASCII command, the data and
ArcGrid header information are in a single text file. arcgridread will also read a .prj
ASCII file, if one is present. This format is also known as Arc ASCII Grid or ESRI
ASCII Raster format.
In this format, created by the ArcGIS GRIDFLOAT command, data and header
information are in separate files (.flt and .hdr). Specify the name of the .flt
GridFloat
file (including the file extension). arcgridread will also read a .prj file, if
one is present. This format is also known as ESRI GridFloat.
Type
Description
Identifier
'geographic'
Returns a geographic cells reference object appropriate to a
latitude/longitude system.
'planar'
Returns a map cells reference object appropriate to a projected map
coordinate system.
'auto' Type of raster reference object determined by the file contents.
Output Arguments
collapse all
Gridded data set, returned as a 2-D array. The class of the array depends on the format of
the data, described in the following table. arcgridread assigns NaN to elements of Z
corresponding to null data values in the grid file.
Raster referencing information, returned as a raster reference object whose type matches
the coordinates reference system defined in the projection file. If no projection file exists
and you do not specify thecoordinateSystemType parameter,R is a referencing matrix.
Tips
The arcgridread function does not import data in the ArcGrid Binary format (also
known as ArcGrid, Arc/INFO Grid, and ESRI ArcInfo Grid). ArcGIS uses this
format internally and it uses multiple files in a folder with standard names such as
hdr.adf and w001001.adf.
See Also
geotiffread | sdtsdemread | worldfileread
ascii2xyz
version 1.1 (2.63 KB) by Andrew Stevens
ASCII2XYZ reads in a raster text file in ARC ASCII format and converts values to a m x 3
matrix of x, y, a z values.
This code is mostly vectorized and performs well with reasonably large files (see example
below).
%read in a 25 MB file
a=dir('foo.txt')
a=
name: 'foo.txt'
date: '17-Oct-2008 08:53:34'
bytes: 25437683
isdir: 0
datenum: 7.3370e+005
tic
xyz=ascii2xyz('foo.txt');
toc
Elapsed time is 8.110956 seconds.