Resample (Data Management)
Summary
Alters the raster dataset by changing the cell size and resampling method.
Usage
-
The cell size can be changed, but the extent of the raster dataset will remain the same.
-
This tool can only output a square cell size.
-
You can save your output to BIL, BIP, BMP, BSQ, DAT, GIF, GRID, IMG, JPEG, JPEG 2000, PNG, TIFF, or any geodatabase raster dataset.
-
There are four options for the Resampling Technique parameter:
- The NEAREST option, which performs a nearest neighbor assignment, is the fastest of the interpolation methods. It is used primarily for discrete data, such as a land-use classification, since it will not change the values of the cells. The maximum spatial error will be one-half the cell size.
- The MAJORITY option, which performs a majority algorithm, determines the new value of the cell based on the most popular values within the filter window. It is mainly used with discrete data just as the nearest neighbor method; Majority tends to give a smoother result than Nearest.
- The BILINEAR option, which performs a bilinear interpolation, determines the new value of a cell based on a weighted distance average of the four nearest input cell centers. It is useful for continuous data and will cause some smoothing of the data.
- The CUBIC option, which performs a cubic convolution, determines the new value of a cell based on fitting a smooth curve through the 16 nearest input cell centers. It is appropriate for continuous data, although it may result in the output raster containing values outside the range of the input raster. It is geometrically less distorted than the raster achieved by running the nearest neighbor resampling algorithm. The disadvantage of the Cubic option is that it requires more processing time. In some cases, it can result in output cell values outside the range of input cell values. If this is unacceptable, use Bilinear instead.
The Bilinear and Cubic options should not be used with categorical data, since the cell values may be altered.
-
The lower left corner of the output raster dataset will be the same map space coordinate location as the lower left corner of the input raster dataset.
-
The numbers of rows and columns in the output raster are determined as follows:
columns = (xmax - xmin) / cell size rows = (ymax - ymin) / cell size
-
If there is any remainder from the above equations, rounding of the number of columns and/or rows is performed.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The input raster dataset. | Raster Layer |
out_raster |
The 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 |
cell_size (Optional) |
The cell size for the new raster dataset. | Analysis cell size |
resampling_type (Optional) |
The resampling algorithm to be used. The default is NEAREST.
| String |
Code Sample
This is a Python sample for the Resample tool.
import arcpy arcpy.Resample_management("c:/data/image.tif", "c:/data/resampled.tif", "10", "CUBIC")
This is a Python script sample for the Resample tool.
##==================================== ##Resample ##Usage: Resample_management in_raster out_raster {cell_size} {NEAREST | BILINEAR | CUBIC | MAJORITY} try: import arcpy arcpy.env.workspace = r"C:/Workspace" ##Resample TIFF image to a higher resolution arcpy.Resample_management("image.tif", "resample.tif", "10", "CUBIC") except: print "Resample example failed." print arcpy.GetMessages()