Warp (Data Management)

License Level:BasicStandardAdvanced

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

Example of two-dimensional coordinate transformations

Usage

Syntax

Warp_management (in_raster, source_control_points, target_control_points, out_raster, {transformation_type}, {resampling_type})
ParameterExplanationData 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:

  • .bil—Esri BIL
  • .bip—Esri BIP
  • .bmp—BMP
  • .bsq—Esri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • no extension for Esri Grid

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.

  • POLYORDER0A zero-order polynomial is used to shift your data. This is commonly used when your data is already georeferenced, but a small shift will better line up your data. Only one link is required to perform a zero-order polynomial shift.
  • POLYORDER1A first-order polynomial (affine) fits a flat plane to the input points. This is the default.
  • POLYORDER2A second-order polynomial fits a somewhat more complicated surface to the input points.
  • POLYORDER3A third-order polynomial fits a more complicated surface to the input points.
  • ADJUSTA transformation that optimizes for both global and local accuracy. It accomplishes this by first performing a polynomial transformation, then adjusting the control points locally, to better match the target control points, using a triangulated irregular network (TIN) interpolation technique.
  • SPLINEA transformation that exactly transforms the source control points to the target control points. This means that the control points will be accurate, but the raster pixels that are between the control points are not.
  • PROJECTIVEA transformation that can warp lines so they remain straight. In doing so, lines that were once parallel may no longer remain parallel. The projective transformation is especially useful for oblique imagery, scanned maps, and for some imagery products.
String
resampling_type
(Optional)

The resampling algorithm to be used. The default is NEAREST.

  • NEARESTNearest neighbor assignment
  • BILINEARBilinear interpolation
  • CUBICCubic convolution
  • MAJORITYMajority resampling

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

Warp example 1 (Python window)

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")
Warp example 2 (stand-alone script)

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()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
11/18/2013