Summary
Converts a file of binary floating-point values 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. Raster to Float only writes the origin as the lower left corner of the lower left cell.
Once the output raster has been created, use the Define Projection tool to give it the appropriate coordinate system.
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 Compression environment settings, only the type of compression may be honored. This is only for raster formats other than Esri Grid.
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. 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 |
Code sample
FloatToRaster example 1 (Python window)
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")
FloatToRaster example 2 (stand-alone script)
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