Summary
Converts a file of binary floating-point values representing raster data to a raster dataset.
Legacy:
This is a deprecated tool. The Copy Raster tool can now be used to convert a float file representing raster data to a raster dataset.
Usage
The input file is an IEEE floating-point format, 32-bit signed binary file.
Two inputs are required: the binary floating-point file with a .flt extension (<in_float_file>.flt) and an ASCII header file with a .hdr extension (<in_float_file>.hdr). You only specify the .flt file; however, there needs to be an existing .hdr file in the same directory with the same file name.
The ASCII file consists of header information containing a set of keywords.
There are two variations of the structure of the ASCII file. One identifies the origin by the coordinates of the lower left corner of the lower left cell, the other as the center of the lower left cell.
The format of the file in general is:
NCOLS xxx NROWS xxx XLLCORNER xxx YLLCORNER xxx CELLSIZE xxx NODATA_VALUE xxx BYTEORDER <MSBFIRST | LSBFIRST>
The definitions of the keywords are as follows:
NCOLS and NROWS are the number of columns and rows in the raster defined by the binary file.
XLLCORNER and YLLCORNER are the coordinates of the lower left corner of the lower left cell.
You can also use XLLCENTER and YLLCENTER to specify the origin by the coordinates of the center of the lower left cell.
CELLSIZE is the cell size of the raster.
NODATA_VALUE is the value that is to represent NoData cells.
BYTEORDER represents how multibyte binary numbers are stored on the system on which the binary file was generated. On Intel CPU-based systems, the byte order is LSBFIRST (also known as Little Endian). On most other architectures (most UNIX systems except Alpha, and older Macintoshes with Motorola CPUs), the byte order is MSBFIRST (also known as Big Endian).
The NODATA_VALUE is the value in the input file that determines which cells should be assigned the value of NoData in the output raster. NoData is normally reserved for those cells whose true value is unknown.
In a floating-point binary file, the values are written as binary 32-bit signed floating-point numbers. The first record of the file corresponds to the first row of the raster. Going from left to right, the first 32 bits are the first cell, the next 32 bits are the second cell, and so on, to the end of the record (row). This is repeated for the second record (the second row of the raster) and all the way until the last record (the bottom row of the raster).
This tool supports both the lower left corner and the center of the lower left cell for determining the origin.
Once the output raster has been created, use the Define Projection (management) tool to give it the appropriate coordinate system.
Certain Raster storage environments may apply to this tool.
Syntax
arcpy.conversion.FloatToRaster(in_float_file, out_raster)
Parameter | Explanation | Data Type |
in_float_file | The input floating-point binary file. The file must have a .flt extension. There must be a header file in association with the floating-point binary file, with a .hdr extension. | File |
out_raster | The output raster dataset to be created. If the output raster will not be saved to a geodatabase, specify .tif for TIFF file format, .CRF for CRF file format, .img for ERDAS IMAGINE file format, or no extension for Esri Grid raster format. | Raster Dataset |
Code sample
Converts a file of binary floating-point values representing raster data to a raster dataset.
import arcpy
arcpy.FloatToRaster_conversion("c:/data/elevation.flt", "c:/output/elev")
Converts a file of binary floating-point values representing raster data to a raster dataset.
# Name: FloatToRaster_Ex_02.py
# Description: Converts a file of binary floating-point values representing
# raster data to a raster dataset.
# Import system modules
import arcpy
# Set local variables
inASCII = "c:/data/elevation.flt"
outRaster = "c:/output/elev02"
# Execute FloatToRaster
arcpy.FloatToRaster_conversion("c:/data/elevation.flt", "c:/output/elev02")
Environments
Licensing information
- Basic: Yes
- Standard: Yes
- Advanced: Yes