ASCII to Raster (Conversion)

License Level:BasicStandardAdvanced

Summary

Converts an ASCII file representing raster data to a raster dataset.

Usage

Syntax

ASCIIToRaster_conversion (in_ascii_file, out_raster, {data_type})
ParameterExplanationData Type
in_ascii_file

The input ASCII file to be converted.

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 an Esri Grid raster format.

Raster Dataset
data_type
(Optional)

The data type of the output raster dataset.

  • INTEGERAn integer raster dataset will be created.
  • FLOATA floating-point raster dataset will be created.
String

Code Sample

ASCIIToRaster example 1 (Python window)

Converts an ASCII file representing raster data to a raster dataset.

import arcpy
arcpy.ASCIIToRaster_conversion("c:/data/elevation.asc", "c:/output/elevation", 
                               "INTEGER")
ASCIIToRaster example 2 (stand-alone script)

Converts an ASCII file representing raster data to a raster dataset.

# Name: ASCIIToRaster_Ex_02.py
# Description: Converts an ASCII file representing raster data to a raster 
#    dataset.

# Import system modules
import arcpy

# Set local variables
inASCII = "c:/data/elevation.asc"
outRaster = "c:/output/elevation02"
rasterType = "INTEGER"

# Execute ASCIIToRaster
arcpy.ASCIIToRaster_conversion(inASCII, outRaster, rasterType)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
10/24/2012