DEM to Raster (Conversion)
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 is for integer DEMs, where the resulting raster will occupy more disk space than it needs. This can be rectified by subsequently running the Int tool on the raster. 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.
Syntax
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, .img for an ERDAS IMAGINE file format, or no extension for a 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 meters). | Double |
Code Sample
Converts a USGS DEM to a raster dataset.
import arcpy arcpy.DEMToRaster_conversion("c:/data/fixed.dem", "c:/output/fixeddem.tif", "FLOAT", 1)
Converts a USGS DEM to a raster dataset.
# Name: DEMToRaster_Ex_02.py # Description: Converts a USGS DEM file to a raster dataset. # Requirements: None # 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)