Summary
Converts a digital elevation model (DEM) in a United States Geological Survey (USGS) format to a raster dataset.
Usage
The majority of DEM files are integer. If a floating-point type DEM is converted with the output data type set to INTEGER, the values will be truncated; however, it is not easy to identify if a particular DEM file happens to be floating point. To prevent inadvertent loss of floating-point data when it exists, the default output data type of the raster will be floating point. The only cost of this is for integer DEMs, where the resulting floating-point representation of the information will occupy more disk space than needed to represent the information as an integer raster. Subsequently, you can run the output from the DEM to Raster tool through the Int tool so the output will consume less disk space. If the input dataset is known to be an integer type, then the INTEGER option can be selected instead of the default.
DEM to Raster applies the spatial resolution value stored in the DEM. In USGS DEMs, this information is stored in Data Element 14 in Logical Record Type A. The spatial resolution value is used to scale all input DEM elevation values.
The output raster will have square cells if the specified format is Esri Grid. If the input DEM has a different sample point spacing in the x and y directions, it will be resampled by bilinear interpolation during the conversion process to a cell size equal to the smaller of the point spacings of the DEM in the x or y.
For output to a Grid raster, the projection and units information contained in the DEM header record is transferred to a map projection file in the output grid directory. If the output raster is a different format, the projection information will be transferred to the .aux file.
Certain Raster storage environments may apply to this tool.
For the Pyramid environment settings, only the Build pyramids setting is honored. The remaining Pyramid environment settings are ignored. More control over the nature of the pyramids can be obtained in a subsequent step by using the Build Pyramids tool.
For the Raster statistics environment settings, only setting the Calculate Statistics parameter to None is supported (the other parameters are ignored). This is only for raster formats other than Esri Grid.
For the Compression environment settings, only the type of compression may be honored. This is only for raster formats other than Esri Grid.
Syntax
arcpy.conversion.DEMToRaster(in_dem_file, out_raster, {data_type}, {z_factor})
Parameter | Explanation | Data Type |
in_dem_file | The input USGS DEM file. The DEM must be standard USGS 7.5 minute, 1 degree, or any other file in the USGS DEM format. The DEM may be in either fixed or variable record-length format. | File |
out_raster | The output raster dataset to be created. When not saving to a geodatabase, specify .tif for a TIFF file format, .CRF for CRF file format, .img for an ERDAS IMAGINE file format, or no extension for an Esri Grid raster format. | Raster Dataset |
data_type (Optional) | Data type of the output raster dataset.
| String |
z_factor (Optional) | The number of ground x,y units in one surface z unit. The z-factor adjusts the units of measure for the z units when they are different from the x,y units of the input surface. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface. If the x,y units and z units are in the same units of measure, the z-factor is 1. This is the default. If the x,y units and z units are in different units of measure, the z-factor must be set to the appropriate factor, or the results will be incorrect. For example, if your z units are feet and your x,y units are meters, you would use a z-factor of 0.3048 to convert your z units from feet to meters (1 foot = 0.3048 meter). | Double |
Code sample
DEMToRaster example 1 (Python window)
Converts a USGS DEM to a raster dataset.
import arcpy
arcpy.DEMToRaster_conversion("c:/data/fixed.dem", "c:/output/fixeddem.tif",
"FLOAT", 1)
DEMToRaster example 2 (stand-alone script)
Converts a USGS DEM to a raster dataset.
# Name: DEMToRaster_Ex_02.py
# Description: Converts a USGS DEM file to a raster dataset.
# Import system modules
import arcpy
# Set local variables
inDEM = "c:/data/fixed.dem"
outRaster = "c:/output/fixeddem.tif"
rasterType = "FLOAT"
zFactor = 0.30488
# Execute DEMToRaster
arcpy.DEMToRaster_conversion(inDEM, outRaster, rasterType, zFactor)
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes