Make Raster Layer (Data Management)

License Level:BasicStandardAdvanced

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

Syntax

MakeRasterLayer_management (in_raster, out_rasterlayer, {where_clause}, {envelope}, {band_index})
ParameterExplanationData 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

MakeRasterLayer example 1 (Python window)

This is a Python sample for MakeRasterLayer.

import arcpy
arcpy.MakeRasterLayer_management("c:/workspace/image.tif", "rdlayer", "#", "feature.shp", "1")
MakeRasterLayer example 2 (stand-alone script)

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()

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
5/7/2015