概要
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:
| String |
type (読み取り専用) | Returns a string that represents the colorizer type. | String |
コードのサンプル
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