Make Raster Layer (Data Management)
Summary
Creates a raster layer from an input raster dataset or layer file. The layer that is created by the tool is temporary and will not persist after the session ends unless the layer is saved to disk or the map document is saved.
This tool can be used to make a temporary layer, so you can work with a specified subset of bands within a raster dataset.
Usage
-
To make your layer permanent, right-click the layer in the table of contents and click Save As Layer File, or use the Save To Layer File tool.
Syntax
Parameter | Explanation | Data Type |
in_raster |
The path and name of the input raster dataset. | Composite Geodataset |
out_rasterlayer |
The name of the temporary output raster dataset. | Raster Layer |
where_clause (Optional) |
A query statement using the fields and values of the raster dataset. To add this variable, press F8, or right-click and click Insert Variable. | SQL Expression |
envelope (Optional) |
Using the min x, min y, max x, or max y, you can specify the extents of the raster layer. To add this variable, press F8, or right-click and click Insert Variable. | Extent |
band_index ID (Optional) |
Choose which bands to export for the layer. If no bands are specified, then all the bands will be used in the output. | Value Table |
Code Sample
This is a Python sample for MakeRasterLayer.
import arcpy
arcpy.MakeRasterLayer_management("c:/workspace/image.tif", "rdlayer", "#", "feature.shp", "1")
This is a Python script sample for MakeRasterLayer.
##====================================
##Make Raster Layer
##Usage: MakeRasterLayer_management in_raster out_rasterlayer {where_clause} {envelope}
## {Index;Index...}
try:
import arcpy
arcpy.env.workspace = r"C:/Workspace"
##Create raster layer from single raster dataset with clipping feature
arcpy.MakeRasterLayer_management("image.tif", "rdlayer", "#", "feature.shp", "1")
print arcpy.GetMessages()
except:
print "Make Raster Layer example failed."
print arcpy.GetMessages()