Make Raster Layer (Data Management)

Summary

Creates a raster layer from an input raster dataset or layer file. The layer 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

  • The output can be created with only a subset of the bands. This will save time and disk space.

  • You can use a raster layer from a GeoPackage as the input. To reference a raster within a GeoPackage, type the name of the path, followed by the name of the GeoPackage and the name of the raster. For example, c:\data\sample.gpkg\raster_tile would be your input raster, where sample.gpkg is the name of the GeoPackage and raster_tile is the raster dataset within the package.

Parameters

LabelExplanationData Type
Input raster

The path and name of the input raster dataset.

You can use a raster layer from a GeoPackage as the input. To reference a raster within a GeoPackage, type the name of the path, followed by the name of the GeoPackage and the name of the raster. For example, c:\data\sample.gpkg\raster_tile would be your input raster, where sample.gpkg is the name of the GeoPackage and raster_tile is the raster dataset within the package.

Composite Geodataset
Output raster layer name

The name of the layer to create.

Raster Layer
Where clause
(Optional)

Define a query using SQL or use the Query Builder to build a query.

SQL Expression
Envelope
(Optional)

The output extent can be specified by defining the four coordinates or by using the extent of an existing layer.

  • Current Display Extent Map View—The extent will be based on the active map or scene. This option is only available when there is an active map.
  • Draw Extent Square and Finish—The extent will be based on a rectangle drawn on the map or scene. This option will create a feature class in the project geodatabase and add a layer to the map. The feature class will have the same coordinate system as the map.
    Note:

    This option is not available in the Environments dialog box. It is only available from a tool parameter with an extent data type or from the Environments tab on a tool dialog box.

    Note:

    When the Enable and disable editing from the Edit tab editing option is checked, you must enable editing on the Edit ribbon tab to draw the extent.

  • Extent of a Layer Layer—The extent will be based on an active map layer. Use the drop-down list to choose an available layer or use the Extent of data in all layers option to get the combined extent of all active map layers, excluding the basemap. This option is only available when there is an active map with layers.

    Each map layer has the following options:

    • All Features Select All—The extent of all features in the layer.
    • Selected Features Area from Selected Features—The extent of the selected features in the layer.
    • Visible Features Extent Indicator—The extent of the visible features in the layer.
      Note:

      The extents from the Selected Features Area from Selected Features and Visible Features Extent Indicator options are only available for feature layers.

  • Browse Browse—The extent will be based on an existing dataset.
  • Clipboard Paste—The extent can be copied to and pasted from the clipboard.
    • Copy Extent Copy—Copies the extent coordinates and coordinate system to the clipboard.
    • Use Paste Extent Paste—Pastes the extent coordinates and, optionally, the coordinate system from the clipboard. If the clipboard values do not include a coordinate system, the extent will use the map’s coordinate system.
    Note:

    The extent coordinates are copied to and pasted from the clipboard using the same formatting and order as the ArcPy Extent object: x-min, y-min, x-max, y-max, and the spatial reference.

  • Reset Extent Reset—The extent will be reset to the default value.
  • Manually entered coordinates—The coordinates must be numeric values and in the active map's coordinate system.
    Caution:

    The map may use different display units than the entered coordinates. The use of a cardinal direction (N, S, E, W) is not supported. Use a negative value sign for south and west coordinates.

Extent
Bands
(Optional)

The bands that will be exported for the layer. If no bands are specified, all the bands will be used in the output.

Value Table

arcpy.management.MakeRasterLayer(in_raster, out_rasterlayer, {where_clause}, {envelope}, {band_index})
NameExplanationData Type
in_raster

The path and name of the input raster dataset.

You can use a raster layer from a GeoPackage as the input. To reference a raster within a GeoPackage, type the name of the path, followed by the name of the GeoPackage and the name of the raster. For example, c:\data\sample.gpkg\raster_tile would be your input raster, where sample.gpkg is the name of the GeoPackage and raster_tile is the raster dataset within the package.

Composite Geodataset
out_rasterlayer

The name of the layer to create.

Raster Layer
where_clause
(Optional)

Define a query using SQL.

SQL Expression
envelope
(Optional)

The output extent can be specified by defining the four coordinates or by using the extent of an existing layer.

  • MAXOF—The maximum extent of all inputs will be used.
  • MINOF—The minimum area common to all inputs will be used.
  • DISPLAY—The extent is equal to the visible display.
  • Layer name—The extent of the specified layer will be used.
  • Extent object—The extent of the specified object will be used.
  • Space delimited string of coordinates—The extent of the specified string will be used. Coordinates are expressed in the order of x-min, y-min, x-max, y-max.
Extent
band_index
[band_index,...]
(Optional)

The bands that will be exported for the layer. If no bands are specified, all the bands will be used in the output.

Value Table

Code sample

MakeRasterLayer example 1 (Python window)

This is a Python sample for the MakeRasterLayer tool.

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 tool.

##====================================
##Make Raster Layer
##Usage: MakeRasterLayer_management in_raster out_rasterlayer {where_clause} {envelope}
##                                  {Index;Index...}
    
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")

Related topics