Raster To Other Format (Conversion)
Summary
Converts one or more raster dataset formats supported by ArcGIS to a BIL, BIP, BMP, BSQ, ENVI DAT, GIF, ERDAS IMAGINE, Esri Grid, JPEG, JPEG 2000, PNG, TIFF, or to a geodatabase raster dataset format.
Usage
This tool allows you to batch convert many raster datasets to a different format at once.
If a raster exists with the same name and format of an input raster, that output will have an incremented name. For example, if you have two input rasters named elevras.img and landuse.tif, and the Raster Format is set to TIFF, the output rasters will be named something similar to elevras.tif and landuse_1.tif
If any of the input rasters cannot be converted to the specified output format as a result of the limitations for that format—for example, supported pixel types or number of bands—an error will be returned. The tool will then proceed to the next input raster in the list.
Syntax
Parameter | Explanation | Data Type |
Input_Rasters [Input_Rasters,...] |
The input raster datasets you wish to convert. | Raster Dataset |
Output_Workspace |
The location where converted raster datasets will be stored. | Workspace ;Raster Catalog |
Raster_Format (Optional) |
The format of the output raster dataset.
| String |
Code Sample
This sample converts several input rasters of different formats and outputs them as rasters all of the same format.
import arcpy
from arcpy import env
env.workspace = "c:/data/PrjWorkspace/RasGP"
arcpy.RasterToOtherFormat_conversion("test.tif;test2.tif;test3.tif",\
"OtherFormat","BIL")
This sample converts several input rasters of different formats and outputs them as rasters all of the same format..
##=========================
##Raster To Other Format
##Usage: RasterToOtherFormat_conversion Input_Rasters;Input_Rasters... Output_Workspace {TIFF | BIL | BIP
## | BMP | BSQ | ENVI DAT | GIF | GRID | IMAGINE Image | JP2000 | JPEG | PNG}
try:
import arcpy
arcpy.env.workspace = r"\\MyMachine\PrjWorkspace\RasGP"
##Convert Multiple Raster Dataset to FGDB
arcpy.RasterToOtherFormat_conversion("test1;test2.tif;test3.img","OtherFormat.gdb","")
##Load Raster Catalog
arcpy.RasterToOtherFormat_conversion("test.tif;test2.tif;test3.tif","OtherFormat","BIL")
except:
print "Raster To Other Format exsample failed."
print arcpy.GetMessages()