Render

Disponible con licencia de Image Analyst.

Resumen

Creates a rendered raster object by applying symbology to the referenced raster dataset. This function is useful when displaying data in a Jupyter notebook.

Debate

Use the Render function to modify the display of a raster object for improved symbology. This function is useful when working in a Jupyter notebook, where data display is a key benefit to the notebook environment.

The function creates a raster object with the rendering rule or color map applied. There must be at least one rendering rule or color map specified.

The referenced raster dataset for the raster object is temporary. To make it permanent, you can call the raster object's save method.

The resulting raster dataset will include the rendering rules applied with the function.

Sintaxis

Render (in_raster, {rendering_rule}, {colormap})
ParámetroExplicaciónTipo de datos
in_raster

The input raster dataset.

Raster
rendering_rule

The rendering rules to apply to the input raster. If a color map is not specified, a rendering rule must be specified.

The rendering rules can use one or more of the following formats:

  • bands—A list of band indexes to be mapped to an RGB display.

    For example, to create a natural color composite for Landsat 8 imagery, where band 4 is displayed as red, band 3 as green, and band 2 as blue, use {'bands': [4, 3, 2]}.

  • min and max—A range of values to use to perform a linear stretch on the raster. The minimum and maximum values are used as endpoints for the histogram stretch, and they can be single inputs or a list of values, one pair per band.

    For example, to perform a linear stretch from pixel value 0 to 100 for a single-band raster, use {'min': 0, 'max': 100}. To perform a linear stretch on a three-band image where each will stretch from a pixel value of 0 to different maximum pixel values, use {'min': 0, 'max': [220,210,180]}.

  • numberOfStandardDeviations—A single value that describes the number of standard deviations to use for a linear stretch. The stretch will be applied between minimum and maximum pixel values defined by the number of standard deviations from the mean.

    For example, to perform a linear stretch that removes any pixel values beyond two standard deviations from the mean, use {'numberOfStandardDeviations': 2}.

  • gamma—A single value or a list of values (one per band) that defines the amount of gamma correction to apply to control the overall brightness of the raster display. Gamma can also impact the ratios of red to green to blue in the display.

    For example, to perform a gamma stretch of 0.5, use {'gamma': 0.5}. To perform various gamma stretches on a three-band raster, use {'gamma': [0.5, 2, 1.5]}.

  • rft—A path to a raster function template (.rft.xml) where the stretch is defined by a raster function chain.

    For example, {'rft': r"C:\StretchFunctions\Remap_and_Stretch.rft.xml"}.

Dictionary
colormap

Defines the colors to use for rendering. If a rendering rule is not specified, a color map must be specified.

The parameter must use one of the following formats:

  • The name of a color map or color scheme that is supported in ArcGIS Pro. For example, colormap="Red to Green". For a full list of supported color schemes, download the ArcGIS_Pro_ColorSchemes.pdf PDF document.
  • A list of hex color codes, named colors, or both. There are 16 supported named colors:
    • aqua
    • black
    • blue
    • fuchsia
    • gray
    • green
    • lime
    • maroon
    • navy
    • olive
    • purple
    • red
    • silver
    • teal
    • white
    • yellow

    For example, ["#B0C4DE", "blue", "navy"].

  • A dictionary with the following key value pairs:
    • "values": [<pixel_value1>, <pixel_value2>, ... ]
    • "colors": ["<color1>", "<color2", ... ]
    • "labels": ["<label1>", "<label2>", ... ]

    For example, {"values": [11, 21, 30], "colors": ["#B0C4DE", "green", "gray"], "labels": ["water", "vegetation", "urban"]}

String
Valor de retorno
Tipo de datosExplicación
Raster

The output rendered raster object.

Muestra de código

Render example 1

Renders a single-band NDVI raster using a linear stretch and NDVI color scheme.

import arcpy
from arcpy.ia import *

arcpy.CheckOutExtension("ImageAnalyst")

# Set input raster
in_Raster = arcpy.Raster(r"C:\Data\NDVI_Raster.tif")

# Render the raster with a linear stretch and the NDVI color scheme
rendered_raster = arcpy.ia.Render(inRaster, rendering_rule=
	{'min': 0, 'max': 0.8}, colormap='NDVI')
rendered_raster
Render example 2

Renders a multiband Landsat 7 image false color, with a stretch applied and a gamma stretch for each band.

import arcpy
from arcpy.ia import *

arcpy.CheckOutExtension("ImageAnalyst")

# Set input raster
in_Raster = arcpy.Raster(r"C:\Data\Landsat7.tif")

# Render the Landsat 7 image in false color composite
# Include a linear standard deviation stretch, and a gamma stretch for each band
rendered_raster = arcpy.ia.Render(inRaster, rendering_rule=
	{'bands': [4,3,2], 'numberOfStandardDeviations': 2, 'gamma': [1,1.7,1.2]})
rendered_raster
Render example 3

Renders a categorical landcover raster with a custom color map.

import arcpy
from arcpy.ia import *

arcpy.CheckOutExtension("ImageAnalyst")

# Set input raster
in_Raster = arcpy.Raster(r"C:\Data\Landcover.tif")

# Render the landcover dataset with a custom color map
rendered_raster = arcpy.ia.Render(inRaster, colormap=
	{"values": [11,21,31], "colors": ["#486DA2",  "gray",  "green"],
	"labels":["water", "urban", "forest"]})

rendered_raster
Render example 4

Renders a multidimensional raster using a raster function template and a colormap.

import arcpy
from arcpy.ia import *

arcpy.CheckOutExtension("ImageAnalyst")

# Set input multidimensional raster
in_Raster = arcpy.Raster(r"C:\Data\Landsat8_Time_Series.crf", True)

# Render each slice in the imagery time series data with a stretched 
# Normalized Difference Water Index described in a raster function template
rendered_raster = arcpy.ia.Render(inRaster, rendering_rule=
	{'rft': r"C:\Data\NDWI.rft.xml"}, colormap="Red to Blue")

rendered_raster