Zusammenfassung
Creates a rendered raster object by applying symbology to the referenced raster dataset. This function is useful when displaying data in a Jupyter notebook.
Diskussion
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.
Syntax
Render (in_raster, {rendering_rule}, {colormap})
Parameter | Erläuterung | Datentyp |
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:
| 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:
| String |
Datentyp | Erläuterung |
Raster | The output rendered raster object. |
Codebeispiel
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
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
Renders a categorical land cover 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
Renders a multidimensional raster using a raster function template and a color map.
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 Green")
rendered_raster