Shift (Data Management)

Summary

Moves (slides) the raster to a new geographic location, based on x and y shift values. This tool is helpful if your raster dataset needs to be shifted to align with another data file.

Illustration

Shift illustration

Usage

Syntax

Shift_management (in_raster, out_raster, x_value, y_value, {in_snap_raster})
ParameterExplanationData Type
in_raster

The input raster dataset.

Raster Layer
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 file
  • .jpg—JPEG
  • .jp2—JPEG 2000
  • .png—PNG
  • .tif—TIFF
  • no extension—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
x_value

The value used to shift the x coordinates.

Double
y_value

The value used to shift the y coordinates.

Double
in_snap_raster
(Optional)

The raster dataset used to align the cells of the output raster dataset.

Raster Layer

Code Sample

Shift example 1 (Python window)

This is a Python sample for the Shift tool.

import arcpy
arcpy.Shift_management("c:/data/image.tif", "c:/output/shift.tif", "100",\
                       "150", "snap.tif")
Shift example 2 (stand-alone script)

This is a Python script sample for the Shift tool.

##====================================
##Shift
##Usage: Shift_management in_raster out_raster x_value y_value {in_snap_raster}
    
try:
    import arcpy
    
    arcpy.env.workspace = r"C:/Workspace"
    
    ##Shift a TIFF image by 4.5 in X direction and 6 in Y direction
    ##Snap the output to a existing raster dataset
    arcpy.Shift_management("image.tif", "shift.tif", "4.5", "6", "snap.tif")
    
except:
    print "Shift example failed."
    print arcpy.GetMessages()

Environments

Snap Raster

If the snap raster is set in the tool and also in the Environment Settings, the snap raster from the tool will be used.

Related Topics

Licensing Information

ArcView: Yes
ArcEditor: Yes
ArcInfo: Yes

10/27/2014