Warp (Data Management)
Summary
Performs a transformation on the raster based on the source and target control points using a polynomial transformation. This is similar to georeferencing using a text file.
Illustration
Usage
-
You must specify the source and target coordinates. The transformation type (polynomial order) from which to choose is dependent on the number of control points entered.
-
The default polynomial order (1) will perform an affine transformation.
-
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 by 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.
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 strongly suggested to 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:
columns = (xmax - xmin) / cell size rows = (ymax - ymin) / cell size
-
You can save your output to BIL, BIP, BMP, BSQ, DAT, Esri Grid, GIF, IMG, JPEG, JPEG 2000, PNG, TIFF, or any geodatabase raster dataset.
-
When storing your raster dataset to a JPEG file, a JPEG 2000 file, or a geodatabase, you can specify a Compression type and Compression Quality within the Environment Settings.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The input raster dataset. | Mosaic Layer; Raster Layer |
source_control_points [source_control_point,...] |
The source points are the "from" coordinates of the links. | Point |
target_control_points [target_control_point,...] |
The target points are the "to" coordinates of the links. | Point |
out_raster |
Output raster dataset. When storing the raster dataset in a file format, you need to specify the file extension:
When storing a raster dataset in a geodatabase, no file extension should be added 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. | Raster Dataset |
transformation_type (Optional) |
The geometric transformation type.
| String |
resampling_type (Optional) |
The resampling algorithm to be used. The default is NEAREST.
The NEAREST and MAJORITY options are used for categorical data, such as a land-use classification. The NEAREST option is the default since it is the quickest and also because it will not change the cell values. Do not use NEAREST or MAJORITY for continuous data, such as elevation surfaces. The BILINEAR option and the CUBIC option are most appropriate for continuous data. It is not recommended that BILINEAR or CUBIC be used with categorical data because the cell values may be altered. | String |
Code Sample
This is a Python sample for the Warp tool.
import arcpy
from arcpy import env
env.workspace = "c:/data"
source_pnt = "'234718 3804287';'241037 3804297';'244193 3801275'"
target_pnt = "'246207 3820084';'270620 3824967';'302634 3816147'"
arcpy.Warp_management("raster.img", source_pnt, target_pnt, "warp.tif", "POLYORDER1",\
"BILINEAR")
This is a Python script sample for the Warp tool.
##====================================
##Warp
##Usage: Warp_management in_raster source_control_points;source_control_points...
## target_control_points;target_control_points... out_raster
## {POLYORDER_ZERO | POLYORDER1 | POLYORDER2 | POLYORDER3 |
## ADJUST | SPLINE | PROJECTIVE} {NEAREST | BILINEAR |
## CUBIC | MAJORITY}
try:
import arcpy
arcpy.env.workspace = r"C:/Workspace"
##Warp a TIFF raster dataset with control points
##Define source control points
source_pnt = "'234718 3804287';'241037 3804297';'244193 3801275'"
##Define target control points
target_pnt = outpnts = "'246207 3820084';'270620 3824967';'302634 3816147'"
arcpy.Warp_management("raster.img", source_pnt, target_pnt, "warp.tif", "POLYORDER2",\
"BILINEAR")
except:
print "Warp example failed."
print arcpy.GetMessages()