Resample (Data Management)

Summary

Changes the spatial resolution of a raster dataset and sets rules for aggregating or interpolating values across the new pixel sizes.

Usage

  • The cell size can be changed, but the extent of the raster dataset will remain the same.

  • 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.

  • The Output Cell Size parameter can resample the output to the same cell size as an existing raster layer, or it can output a specific X and Y cell size.

  • There are four options for the Resampling Technique parameter:

    • Nearest—Performs a nearest neighbor assignment and 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.
    • Majority—Performs a majority algorithm and determines the new value of the cell based on the most popular values in the filter window. It is mainly used with discrete data just as the nearest neighbor method; the Majority option tends to give a smoother result than Nearest. The majority resampling method will find corresponding 4 by 4 cells in the input space that are closest to the center of the output cell and use the majority of the 4 by 4 neighbors.
    • Bilinear—Performs a bilinear interpolation and 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.
    • Cubic—Performs a cubic convolution and 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. If this is unacceptable, use Bilinear instead. The output from cubic convolution 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.

    The Bilinear and Cubic options should not be used with categorical data, since the cell values may be altered.

  • If the center of the pixel in output space falls exactly the same as one of the pixels in the input cells, that particular cell value receives all the weights, causing the output pixel to be the same as the cell center. This will affect the result of bilinear interpolation and cubic convolution.

  • 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 number 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 rows is performed.

  • 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 dataset with the spatial resolution to be changed.

Mosaic Dataset; Mosaic Layer; Raster Dataset; Raster Layer
Output Raster Dataset

The name, location, and format of the dataset being created.

  • .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

When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. When storing a raster dataset to JPEG, JPEG 2000, or TIFF format, or in a geodatabase, you can specify a compression type and compression quality.

Raster Dataset
Output Cell Size
(Optional)

The cell size of the new raster using an existing raster dataset or by specifying its width (x) and height (y).

Cell Size XY
Resampling Technique
(Optional)

Specifies the resampling technique to be used.

  • 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.
String

arcpy.management.Resample(in_raster, out_raster, {cell_size}, {resampling_type})
NameExplanationData Type
in_raster

The raster dataset with the spatial resolution to be changed.

Mosaic Dataset; Mosaic Layer; Raster Dataset; Raster Layer
out_raster

The name, location, and format of the dataset being created.

  • .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

When storing a raster dataset in a geodatabase, do not add a file extension to the name of the raster dataset. When storing a raster dataset to JPEG, JPEG 2000, or TIFF format, or in a geodatabase, you can specify a compression type and compression quality.

Raster Dataset
cell_size
(Optional)

The cell size of the new raster using an existing raster dataset or by specifying its width (x) and height (y).

You can specify the cell size in the following ways:

  • Use a single number specifying a square cell size.
  • Use two numbers that specify the x and y cell size, which is space delimited.
  • Use the path of a raster dataset from which the square cell size will be imported.

Cell Size XY
resampling_type
(Optional)

Specifies the resampling technique to be used.

  • 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.
String

Code sample

Resample example 1 (Python window)

This is a Python sample for the Resample function.

import arcpy
arcpy.Resample_management("c:/data/image.tif", "resample.tif", "10 20", "NEAREST")
Resample example 2 (stand-alone script)

This is a Python script sample for the Resample function.

# Resample TIFF image to a higher resolution

import arcpy
arcpy.env.workspace = r"C:/Workspace"
    
arcpy.Resample_management("image.tif", "resample.tif", "10", "CUBIC")

Licensing information

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

Related topics