Warp (Data Management)

Summary

Transforms a raster dataset using source and target control points. This is similar to georeferencing.

Illustration

Example of two-dimensional coordinate transformations

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 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 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 recommended 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:

    columns = (xmax - xmin) / cell size
    rows = (ymax - ymin) / cell size
  • 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.

  • This tool supports multidimensional raster data. To run the tool on each slice in the multidimensional raster and generate a multidimensional raster output, be sure to save the output to CRF.

    Supported input multidimensional dataset types include multidimensional raster layer, mosaic dataset, image service, and CRF.

Parameters

LabelExplanationData Type
Input Raster

The raster to be transformed.

Mosaic Layer; Raster Layer
Source Control Points

The coordinates of the raster to be warped.

Point
Target Control Points

The coordinates to which the source raster will be warped.

Point
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, JPEG 2000 file, TIFF file, or geodatabase, you can specify a compression type and compression quality.

When storing the raster dataset in a file format, specify the file extension as follows:

  • .bilEsri BIL
  • .bipEsri BIP
  • .bmp—BMP
  • .bsqEsri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • .mrf—MRF
  • .crf—CRF
  • No extension for Esri Grid
Raster Dataset
Transformation Type
(Optional)

Specifies the transformation method for shifting the raster dataset.

  • Shift only A zero-order polynomial will be used to shift the data. This is commonly used when the data is georeferenced, but a small shift will better line it up. Only one link is required to perform a zero-order polynomial shift.
  • Affine transformationA first-order polynomial (affine) will be used to fit a flat plane to the input points.
  • Second-order polynomial transformationA second-order polynomial will be used to fit a somewhat more complicated surface to the input points.
  • Third-order polynomial transformationA third-order polynomial will be used to fit a more complicated surface to the input points.
  • Optimize for global and local accuracy A polynomial transformation is combined with a triangulated irregular network (TIN) interpolation technique that will optimize for both global and local accuracy.
  • Spline transformation The source control points will be transformed precisely to the target control points. In the output, the control points will be accurate, but the raster pixels between the control points will not.
  • Projective transformation Lines will be warped so that 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.
  • Similarity transformation A first order transformation will be used that attempts to preserve the shape of the original raster. The RMS error tends to be higher than other polynomial transformations because the preservation of shape is more important than the best fit.
String
Resampling Technique
(Optional)

Specifies the resampling technique that will 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. 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 with categorical data because the pixel values may be altered.

  • Nearest neighbor The nearest neighbor technique will be used. It minimizes changes to pixel values since no new values are created and is the fastest resampling technique. It is suitable for discrete data, such as land cover.
  • Bilinear interpolation The bilinear interpolation technique will be used. It calculates the value of each pixel by averaging (weighted for distance) the values of the surrounding four pixels. It is suitable for continuous data.
  • Cubic convolutionThe cubic convolution technique will be used. It calculates the value of each pixel by fitting a smooth curve based on the surrounding 16 pixels. This produces the smoothest image but can create values outside of the range found in the source data. It is suitable for continuous data.
  • Majority resamplingThe majority resampling technique will be used. It determines the value of each pixel based on the most popular value in a 4 by 4 window. It is suitable for discrete data.
String

arcpy.management.Warp(in_raster, source_control_points, target_control_points, out_raster, {transformation_type}, {resampling_type})
NameExplanationData Type
in_raster

The raster to be transformed.

Mosaic Layer; Raster Layer
source_control_points
[source_control_point,...]

The coordinates of the raster to be warped.

Point
target_control_points
[target_control_point,...]

The coordinates to which the source raster will be warped.

Point
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, JPEG 2000 file, TIFF file, or geodatabase, you can specify a compression type and compression quality.

When storing the raster dataset in a file format, specify the file extension as follows:

  • .bilEsri BIL
  • .bipEsri BIP
  • .bmp—BMP
  • .bsqEsri BSQ
  • .dat—ENVI DAT
  • .gif—GIF
  • .img—ERDAS IMAGINE
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • .mrf—MRF
  • .crf—CRF
  • No extension for Esri Grid
Raster Dataset
transformation_type
(Optional)

Specifies the transformation method for shifting the raster dataset.

  • POLYORDER0 A zero-order polynomial will be used to shift the data. This is commonly used when the data is georeferenced, but a small shift will better line it up. Only one link is required to perform a zero-order polynomial shift.
  • POLYSIMILARITY A first order transformation will be used that attempts to preserve the shape of the original raster. The RMS error tends to be higher than other polynomial transformations because the preservation of shape is more important than the best fit.
  • POLYORDER1A first-order polynomial (affine) will be used to fit a flat plane to the input points.
  • POLYORDER2A second-order polynomial will be used to fit a somewhat more complicated surface to the input points.
  • POLYORDER3A third-order polynomial will be used to fit a more complicated surface to the input points.
  • ADJUST A polynomial transformation is combined with a triangulated irregular network (TIN) interpolation technique that will optimize for both global and local accuracy.
  • SPLINE The source control points will be transformed precisely to the target control points. In the output, the control points will be accurate, but the raster pixels between the control points will not.
  • PROJECTIVE Lines will be warped so that 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)

Specifies the resampling technique that will be used. The default is Nearest.

  • NEAREST The nearest neighbor technique will be used. It minimizes changes to pixel values since no new values are created and is the fastest resampling technique. It is suitable for discrete data, such as land cover.
  • BILINEAR The bilinear interpolation technique will be used. It calculates the value of each pixel by averaging (weighted for distance) the values of the surrounding four pixels. It is suitable for continuous data.
  • CUBICThe cubic convolution technique will be used. It calculates the value of each pixel by fitting a smooth curve based on the surrounding 16 pixels. This produces the smoothest image but can create values outside of the range found in the source data. It is suitable for continuous data.
  • MAJORITYThe majority resampling technique will be used. It determines the value of each pixel based on the most popular value in a 4 by 4 window. It is suitable for discrete data.

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 with categorical data because the pixel 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}
    

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 = "'246207 3820084';'270620 3824967';'302634 3816147'"

arcpy.Warp_management("raster.img", source_pnt, target_pnt, "warp.tif", "POLYORDER2",\
                      "BILINEAR")

Licensing information

  • Basic: Yes
  • Standard: Yes
  • Advanced: Yes

Related topics