Label | Explanation | Data Type |
Input Raster
| The raster to be transformed. | Mosaic Layer; Raster Layer |
Output Raster Dataset
| The name, location, and format for the dataset you are creating. When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. When storing your raster dataset to a JPEG file, a JPEG 2000 file, a TIFF file, or a geodatabase, you can specify a compression type and compression quality using environment settings.
| Raster Dataset |
Link File
| The text, CSV file, or TAB file containing the coordinates to warp the input raster. This can be generated from the Register Raster tool or from the . | Text File |
Transformation Type
(Optional) | Specifies the transformation method for shifting the raster dataset.
| String |
Resampling Technique
(Optional) | The resampling algorithm to be used.
The Nearest and Majority options are used for categorical data, such as a land-use classification. The Nearest option is the default. It is the quickest and does not change the pixel values. Do not use either of these options for continuous data, such as elevation surfaces. The Bilinear and Cubic options are most appropriate for continuous data. It is recommended that you do not use either of these options with categorical data because the pixel values may be altered. | String |
Summary
Transforms a raster dataset using an existing text file containing source and target control points.
Illustration
Usage
Warp is useful when the raster requires a systematic geometric correction that can be modeled with a polynomial. A spatial transformation can invert or remove a distortion using polynomial transformation of the proper order. The higher the order, the more complex the distortion that can be corrected. The higher orders of polynomial will involve progressively more processing time.
The default polynomial order will perform an affine transformation.
To determine the minimum number of links necessary for a given order of polynomial, use the following formula:
n = (p + 1) (p + 2) / 2
where n is the minimum number of links required for a transformation of polynomial order p. It is suggested that you use more than the minimum number of links.
This tool will determine the extent of the warped raster and will set the number of rows and columns to be about the same as in the input raster. Some minor differences may be due to the changed proportion between the output raster's sizes in the x and y directions. The default cell size used will be computed by dividing the extent by the previously determined number of rows and columns. The value of the cell size will be used by the resampling algorithm.
If you choose to define an output cell size in the Environment settings, the number of rows and columns will be calculated as follows:
You can save the output to BIL, BIP, BMP, BSQ, DAT, Esri Grid, GIF, IMG, JPEG, JPEG 2000, PNG, TIFF, MRF, or CRF format, or any geodatabase raster dataset.
When storing a raster dataset to a JPEG format file, a JPEG 2000 format file, or a geodatabase, you can specify a Compression Type value and a Compression Quality value in the geoprocessing environments.
Each row in the input link file should have the following values, each delimited by a TAB:
<From X> <From Y> <To X> <To Y>
where each row represents the coordinates of a control point pair. There can be additional columns with residual values, but these are not required.
Parameters
arcpy.management.WarpFromFile(in_raster, out_raster, link_file, {transformation_type}, {resampling_type})
Name | Explanation | Data Type |
in_raster | The raster to be transformed. | Mosaic Layer; Raster Layer |
out_raster | The name, location, and format for the dataset you are creating. When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. When storing your raster dataset to a JPEG file, a JPEG 2000 file, a TIFF file, or a geodatabase, you can specify a compression type and compression quality using environment settings.
| Raster Dataset |
link_file | The text, CSV file, or TAB file containing the coordinates to warp the input raster. This can be generated from the Register Raster tool or from the . | Text File |
transformation_type (Optional) | Specifies the transformation method for shifting the raster dataset.
| String |
resampling_type (Optional) | The resampling algorithm to be used.
The Nearest and Majority options are used for categorical data, such as a land-use classification. The Nearest option is the default. It is the quickest and does not change the pixel values. Do not use either of these options for continuous data, such as elevation surfaces. The Bilinear and Cubic options are most appropriate for continuous data. It is recommended that you do not use either of these options with categorical data because the pixel values may be altered. | String |
Code sample
This is a Python sample for the WarpFromFile tool.
import arcpy
arcpy.WarpFromFile_management(
"\\cpu\data\raster.img", "\\cpu\data\warp_out.tif",
"\\cpu\data\gcpfile.txt", "POLYORDER2", "BILINEAR")
This is a Python script sample for the WarpFromFile tool.
##Warp image with signiture file
import arcpy
arcpy.env.workspace = r"C:/Workspace"
arcpy.WarpFromFile_management("raster.img", "warp_output.tif", "gcpfile.txt",
"POLYORDER2", "BILINEAR")