旋转 (Data Management)

许可等级:BasicStandardAdvanced

摘要

将栅格数据集绕特定枢轴点旋转指定的角度(以度为单位)。

在 0 度到 360 度之间指定一个度数,并按照此度数顺时针旋转栅格。若要逆时针旋转栅格,则需要将角度指定为负值。角度可以指定为整型值或浮点型值。

插图

Rotate illustration

用法

语法

Rotate_management (in_raster, out_raster, angle, {pivot_point}, {resampling_type})
参数说明数据类型
in_raster

输入栅格数据集。

Mosaic Layer; Raster Layer
out_raster

输出栅格数据集。

以文件格式存储栅格数据集时,需要指定文件扩展名,具体如下:

  • .bil - Esri BIL
  • .bip - Esri BIP
  • .bmp - BMP
  • .bsq - Esri BSQ
  • .dat - ENVI DAT
  • .gif - GIF
  • .img - ERDAS IMAGINE
  • .jpg - JPEG
  • .jp2 - JPEG 2000
  • .png - PNG
  • .tif - TIFF
  • 无扩展名 - Esri Grid

以地理数据库形式存储栅格数据集时,不应向栅格数据集的名称添加文件扩展名。

将栅格数据集存储到 JPEG 文件、JPEG 2000 文件、TIFF 文件或地理数据库时,可以指定压缩类型和压缩质量。

Raster Dataset
angle

用于旋转栅格的角度值(以度为单位)。它可以是任意浮点数。

Double
pivot_point
(可选)

旋转栅格所围绕的枢轴点。默认枢轴点位于输入栅格数据集的左下角。

Point
resampling_type
(可选)

要使用的重采样算法。默认设置为 NEAREST。

  • NEAREST最邻近分配法
  • BILINEAR双线性插值法
  • CUBIC三次卷积插值法
  • MAJORITY众数重采样法

NEAREST 和 MAJORITY 选项用于分类数据,如土地利用分类。NEAREST 选项是默认设置,因为它是最快的插值法,同时也因为它不会更改像元值。请勿对连续数据(如高程表面)使用 NEAREST 或 MAJORITY。

BILINEAR 选项和 CUBIC 选项最适用于连续数据。不推荐对分类数据使用 BILINEAR 或者 CUBIC,因为像元值可能被更改。

String

代码实例

旋转示例 1(Python 窗口)

这是“旋转”工具的 Python 示例。

import arcpy
arcpy.Rotate_management("c:/data/image.tif", "c:/output/rotate.tif", "30",\
                        "1940000 304000", "BILINEAR")
旋转示例 2(独立窗口)

这是“旋转”工具的 Python 脚本示例。

##====================================
##Rotate
##Usage: Rotate_management in_raster out_raster angle {pivot_point} {NEAREST | BILINEAR | CUBIC | MAJORITY}
    
try:
    import arcpy
    
    arcpy.env.workspace = r"C:/Workspace"
    pivot_point = "1942602 304176"
    
    ##Rescael a TIFF image by a factor of 4 in both directions
    arcpy.Rotate_management("image.tif", "rotate.tif", "30", pivot_point, "BILINEAR")
    
except:
    print "Rotate example failed."
    print arcpy.GetMessages()

环境

相关主题

许可信息

ArcGIS for Desktop Basic: 是
ArcGIS for Desktop Standard: 是
ArcGIS for Desktop Advanced: 是
5/10/2014