Get Raster Properties获得栅格的信息

Summary

Returns the properties of a raster dataset.

Usage

  • The property returned will be displayed in the geoprocessing window.

Syntax

GetRasterProperties_management (in_raster, {property_type})
Parameter Explanation Data Type
in_raster

The input raster dataset.

Raster Layer
property_type
(Optional)

The property to be obtained from the raster dataset.

    <esri_enumhead><esri_enumvaluehd><esri_enumdeschd>
  • MINIMUM —Returns the smallest value of all cells in the input raster.
  • MAXIMUM —Returns the largest value of all cells in the input raster.
  • MEAN —Returns the average of all cells in the input raster.
  • STD —Returns the standard deviation of all cells in the input raster.
  • UNIQUEVALUECOUNT —Returns the number of unique values in the input raster.
  • TOP —Returns the top or YMax value of the extent.
  • LEFT —Returns the left or XMin value of the extent.
  • RIGHT —Returns the right or XMax value of the extent.
  • BOTTOM —Returns the bottom or YMin value of the extent.
  • CELLSIZEX —Returns the cell size in the x-direction.
  • CELLSIZEY —Returns the cell size in the y-direction.
  • VALUETYPE —Returns the type of the cell value in the input raster:
    • 0 = 1-bit
    • 1 = 2-bit
    • 2 = 4-bit
    • 3 = 8-bit unsigned integer
    • 4 = 8-bit signed integer
    • 5 = 16-bit unsigned integer
    • 6 = 16-bit signed integer
    • 7 = 32-bit unsigned integer
    • 8 = 32-bit signed integer
    • 9 = 32-bit floating point
    • 10 = 64-bit double precision
    • 11 = 8-bit complex
    • 12 = 64-bit complex
    • 13 = 16-bit complex
    • 14 = 32-bit complex
  • COLUMNCOUNT —Returns the number of columns in the input raster.
  • ROWCOUNT —Returns the number of rows in the input raster.
  • BANDCOUNT —Returns the number of bands in the input raster.
String

Code Sample

GetRasterProperties example 1 (Python window)

This is a Python sample for GetRasterProperties

import arcpy
from arcpy import env
env.workspace = "c:/data"
#Get the geoprocessing result object
elevSTDResult = arcpy.GetRasterProperties_management("elevation", "STD")

#Get the elevation standard deviation value from geoprocessing result object
elevSTD = elevSTDResult.GetOutput(0)
GetRasterProperties example 2 (stand-alone script)

This is a Python script sample for GetRasterProperties

import arcpy
from arcpy import env
env.workspace = "c:/data"
#Get the geoprocessing result object
elevSTDResult = arcpy.GetRasterProperties_management("elevation", "STD")

#Get the elevation standard deviation value from geoprocessing result object
elevSTD = elevSTDResult.GetOutput(0)
原文地址:https://www.cnblogs.com/gisoracle/p/11168091.html