Main Content

arcgridread

(Not recommended) Read gridded data set in ArcGrid ASCII or GridFloat format

arcgridread is not recommended. Use readgeoraster instead. For more information, see Version History.

Description

[Z,R] = arcgridread(filename) imports a grid in either ArcGrid ASCII or GridFloat format from the file specified by filename. Returns Z, a 2-D array containing the data values, and raster referencing information in R. If the input file is accompanied by a projection file (with extension .prj or .PRJ), then R is a raster reference object whose type matches the coordinate reference system defined in the projection file. Otherwise R is a referencing matrix.

example

[Z,R] = arcgridread(filename,coordinateSystemType) returns R as a raster reference object whose type is consistent with the value specified by coordinateSystemType. This optional input argument can be helpful in the absence of a projection file. The function throws an error if a projection file is present and coordinateSystemType contradicts the type of coordinate reference system defined in the projection file.

Examples

collapse all

Read the data.

[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)

Figure contains an axes object. The axes object with xlabel x (easting in meters), ylabel y (northing in meters) contains an object of type surface.

View the terrain in 3-D.

axis normal
view(3)
axis equal
grid on
zlabel('elevation in feet')

Figure contains an axes object. The axes object with xlabel x (easting in meters), ylabel y (northing in meters) contains an object of type surface.

Input Arguments

collapse all

Name of file containing the grid, specified as a character vector. The arcgridread function supports the following formats.

FormatDescription
ArcGrid ASCIIIn this format, created by the ArcGIS GRIDASCII command, the data and header information are in a single text file. arcgridread will also read a .prj file, if one is present. This format is also known as Arc ASCII Grid or Esri® ASCII Raster format.
GridFloat 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 file (including the file extension). arcgridread will also read a .prj file, if one is present. This format is also known as Esri GridFloat.

Data Types: char

Coordinate system type identifier, specified as one of the following values.

Type IdentifierDescription
'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.

Data Types: char

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.

FormatClass of Returned Gridded Data
ArcGrid ASCII2-D array of class double.
GridFloat 2-D array of class single.

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 the coordinateSystemType 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.

Version History

Introduced before R2006a

collapse all