Skip to main content

RasterStretchColorizer

サマリー

Represents a raster stretch colorizer.

ディスカッション

The raster stretch colorizer stretches values along a color ramp. The properties behave in a similar manner to the options exposed in the application. For example, changing the StretchType will control a subset of additional parameters that can be modified.

プロパティ

名前 説明 データ タイプ

band

(読み取り/書き込み)

An integer that represents a zero-based index matching the order of the bands the way they appear in the Symbology pane. The topmost band is index 0 and the bottommost is n-1.

Integer

colorRamp

(読み取り/書き込み)

Provides access to the ColorRamp object.

ColorRamp

gamma

(読み取り/書き込み)

A double that represents the gamma value.

Double

invertColorRamp

(読み取り/書き込み)

A Boolean that reverses the color ramp's appearance.

Boolean

maxLabel

(読み取り/書き込み)

A string that represents the raster stretch maximum label that appears in the Contents pane or legend.

String

maxPercent

(読み取り/書き込み)

A double that represents the percentage of highest values to cut from the source data. This parameter is only applied if the StretchType is set to MinimumMaximum.

Double

minLabel

(読み取り/書き込み)

A string that represents the raster stretch minimum label that appears in the Contents pane or legend.

String

minPercent

(読み取り/書き込み)

A double that represents the percentage of lowest values to cut from the source data. This parameter is only applied if the StretchType is set to MinimumMaximum.

Double

standardDeviation

(読み取り/書き込み)

A double that represents the standard deviation value. This parameter is only applied if the StretchType is set to StandardDeviation.

Double

stretchType

(読み取り/書き込み)

A string that represents a valid stretching algorithm. The valid values are as follows:

  • Custom—Display values with custom histogram.

  • Esri—Highlight the contrast of moderate values while minimizing the impact of extreme high and low values.

  • HistogramEqualize—Display values with histogram equalize.

  • HistogramSpecification—Display values with histogram specification.

  • MinimumMaximum—Display values between the actual minimum and maximum values.

  • None—Display values between potential minimum and maximum.

  • PercentClip—Cut off percentages of highest and lowest values.

  • StandardDeviation—Display values between a specified number of standard deviations.

String

type

(読み取り専用)

Returns a string that represents the colorizer type.

String

コードのサンプル

RasterStretchColorizer example

The following script first tests whether the layer's symbology supports a colorizer property, then confirms whether the renderer is a RasterStretchColorizer. Next,. it changes the stretchType to PercentClip and sets the appropriate min/max percents. Finally, it changes ColorRamp to a color ramp named Bathymetry #2.

p = arcpy.mp.ArcGISProject('current')
m = p.listMaps('RasterStretch')[0]

for l in m.listLayers():
  if l.isRasterLayer:
    sym = l.symbology
    if hasattr(sym, 'colorizer'):
      if sym.colorizer.type == 'RasterStretchColorizer':

        #Set StretchType = PercentClip
        if l.name == "Photo_SE":
          sym.colorizer.stretchType = "PercentClip"
          sym.colorizer.minPercent = 1.0
          sym.colorizer.maxPercent = 1.0
          cr = p.listColorRamps('Bathymetry #2')[0]
          sym.colorizer.colorRamp = cr
          sym.colorizer.invertColorRamp = True
          sym.colorizer.gamma = 2
          sym.colorizer.minLabel = "Min: " + sym.colorizer.minLabel
          sym.colorizer.maxLabel = "Max: " + sym.colorizer.maxLabel

          l.symbology = sym