Rotate (Data Management)

Summary

Turns a raster dataset around a specified pivot point.

Illustration

Rotate illustration

Usage

  • By default, the rotation is around the center point of the raster. The rotation point can be changed using the optional Pivot Point parameter.

  • Resampling is only done if the angle is not a multiple of 90.

  • Specify a rotation angle between 0 and 360 to rotate the raster clockwise. To rotate the raster in the counterclockwise direction, specify the angle as a negative value.

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

Parameters

LabelExplanationData Type
Input Raster

The raster dataset to rotate.

Mosaic Layer; Raster Layer
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, a JPEG 2000 file, a TIFF file, or a 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
Angle

Specify a value between 0 and 360 degrees the raster will be rotated in the clockwise direction. To rotate the raster in the counterclockwise direction, specify the angle as a negative value. The angle can be specified as an integer or a floating-point value.

Double
Pivot Point
(Optional)

The point the raster will rotate around. If left blank, the lower left corner of the input raster dataset will serve as the pivot.

Point
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 options 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
Clipping Extent
(Optional)

The processing extent of the raster dataset. The source data will be clipped to the specified extent before rotation.

  • Current Display Extent Map View—The extent will be based on the active map or scene. This option is only available when there is an active map.
  • Draw Extent Square and Finish—The extent will be based on a rectangle drawn on the map or scene. This option will create a feature class in the project geodatabase and add a layer to the map. The feature class will have the same coordinate system as the map.
    Note:

    This option is not available in the Environments dialog box. It is only available from a tool parameter with an extent data type or from the Environments tab on a tool dialog box.

    Note:

    When the Enable and disable editing from the Edit tab editing option is checked, you must enable editing on the Edit ribbon tab to draw the extent.

  • Extent of a Layer Layer—The extent will be based on an active map layer. Use the drop-down list to choose an available layer or use the Extent of data in all layers option to get the combined extent of all active map layers, excluding the basemap. This option is only available when there is an active map with layers.

    Each map layer has the following options:

    • All Features Select All—The extent of all features in the layer.
    • Selected Features Area from Selected Features—The extent of the selected features in the layer.
    • Visible Features Extent Indicator—The extent of the visible features in the layer.
      Note:

      The extents from the Selected Features Area from Selected Features and Visible Features Extent Indicator options are only available for feature layers.

  • Browse Browse—The extent will be based on an existing dataset.
  • Clipboard Paste—The extent can be copied to and pasted from the clipboard.
    • Copy Extent Copy—Copies the extent coordinates and coordinate system to the clipboard.
    • Use Paste Extent Paste—Pastes the extent coordinates and, optionally, the coordinate system from the clipboard. If the clipboard values do not include a coordinate system, the extent will use the map’s coordinate system.
    Note:

    The extent coordinates are copied to and pasted from the clipboard using the same formatting and order as the ArcPy Extent object: x-min, y-min, x-max, y-max, and the spatial reference.

  • Reset Extent Reset—The extent will be reset to the default value.
  • Manually entered coordinates—The coordinates must be numeric values and in the active map's coordinate system.
    Caution:

    The map may use different display units than the entered coordinates. The use of a cardinal direction (N, S, E, W) is not supported. Use a negative value sign for south and west coordinates.

Extent

arcpy.management.Rotate(in_raster, out_raster, angle, {pivot_point}, {resampling_type}, {clipping_extent})
NameExplanationData Type
in_raster

The raster dataset to rotate.

Mosaic Layer; Raster Layer
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, a JPEG 2000 file, a TIFF file, or a 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
angle

Specify a value between 0 and 360 degrees the raster will be rotated in the clockwise direction. To rotate the raster in the counterclockwise direction, specify the angle as a negative value. The angle can be specified as an integer or a floating-point value.

Double
pivot_point
(Optional)

The point the raster will rotate around. If left blank, the lower left corner of the input raster dataset will serve as the pivot.

Point
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 options with categorical data because the pixel values may be altered.

String
clipping_extent
(Optional)

The processing extent of the raster dataset. The source data will be clipped to the specified extent before rotation.

  • MAXOF—The maximum extent of all inputs will be used.
  • MINOF—The minimum area common to all inputs will be used.
  • DISPLAY—The extent is equal to the visible display.
  • Layer name—The extent of the specified layer will be used.
  • Extent object—The extent of the specified object will be used.
  • Space delimited string of coordinates—The extent of the specified string will be used. Coordinates are expressed in the order of x-min, y-min, x-max, y-max.
Extent

Code sample

Rotate example 1 (Python window)

This is a Python sample for the Rotate tool.

import arcpy
arcpy.Rotate_management("c:/data/image.tif", "c:/output/rotate.tif", "30",\
                        "1940000 304000", "BILINEAR")
Rotate example 2 (stand-alone script)

This is a Python script sample for the Rotate tool.

##====================================
##Rotate
##Usage: Rotate_management in_raster out_raster angle {pivot_point} {NEAREST | BILINEAR | CUBIC | MAJORITY}
    
import arcpy

arcpy.env.workspace = r"C:/Workspace"
pivot_point = "1942602 304176"

##Rescale a TIFF image by a factor of 4 in both directions
arcpy.Rotate_management("image.tif", "rotate.tif", "30", pivot_point, "BILINEAR")

Related topics