You are here:
Extensions > Spatial Analyst > Spatial Analyst functional reference > Surface (Spatial Analyst)

# Slope

Release 9.3

Print all topics in : "Surface (Spatial Analyst)"

Identifies the rate of maximum change in z-value from each cell.

Illustration

Map Algebra:
` OutRas = Slope(InRas1)`

Command Line:
` Slope_sa InRas1 OutRas`

Usage tips

Command line and Scripting

• Slope is the rate of maximum change in z-value from each cell.

• The use of a z-factor is essential for correct slope calculations when the surface z units are expressed in units different from the ground x,y units.

• The range of slope values in degrees is 0 to 90. For percent rise, the range is 0 for near infinity. A flat surface is 0 percent, a 45 degree surface is 100 percent, and as the surface becomes more vertical, the percent rise becomes increasingly larger.

• If the center cell in the immediate neighborhood (3 x 3 window) is NoData, the output is NoData.

• If any neighborhood cells are NoData, they are assigned the value of the center cell; then the slope is computed.

• The following environment settings affect this tool:

• Map Algebra

• The surface information for calculating the slope can be expressed as raster.item for any numeric item in the value attribute table. The default item is Value.

• The use of a z-factor is essential for correct slope calculations when the surface z units are expressed in units which are different from the ground x,y units.

• The range of slope values in degrees is 0 to 90. For percent rise, the range is 0 for near infinity. A flat surface is 0 percent, a 45 degree surface is 100 percent, and as the surface becomes more vertical, the percent rise becomes increasingly larger.

• If the center cell in the immediate neighborhood (3 x 3 window) is NoData, the output is NoData.

• If any neighborhood cells are NoData, they are assigned the value of the center cell; then the slope is computed.

• Learn more about how to specify the input raster dataset in the Map Algebra expression of Raster Calculator.

• ArcObjects

• Valid input for the geoDataset to ArcObjects is a Raster, RasterDataset, RasterBand, or RasterDescriptor.

• The use of a z-factor is essential for correct slope calculations when the surface z units are expressed in units different from the ground x,y units.

• The range of values with the Degree option of slopeType is 0 to 90. The range of the PercentRise option is 0 to near infinity. A flat surface is 0 percent, a 45 degree surface is 100 percent, and as the surface becomes more vertical, the percent rise becomes increasingly larger.

• If the center cell in the immediate neighborhood (3 x 3 window) is NoData, the output is NoData.

• If any neighborhood cells are NoData, they are assigned the value of the center cell; then the slope is computed.

• The output from the ArcObjects method is a raster object.

Command line syntax
An overview of the Command Line window
Slope_sa <in_raster> <out_raster> {DEGREE | PERCENT_RISE} {z_factor}

 Parameter Explanation Data Type Input raster. Composite Geodataset The raster to be created. Raster Dataset {DEGREE | PERCENT_RISE} Determines the measurement units (degrees or percentages) of the output slope data. DEGREE  — The inclination of slope will be calculated in degrees. PERCENT_RISE  — Keyword to output the percent rise, also referred to as the percent slope. String {z_factor} The number of ground x,y units in one surface z unit. The z-factor adjusts the units of measure for the z units when they are different from the x,y units of the input surface. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface. If the x,y units and z units are in the same units of measure, the z-factor is 1. This is the default. If the x,y units and z units are in different units of measure, the z-factor must be set to the appropriate factor, or the results will be incorrect. For example, if your z units are feet and your x,y units are meters, you would use a z-factor of 0.3048 to convert your z units from feet to meters (1 foot = 0.3048 meter). Double
Data types for geoprocessing tool parameters

### Command line example

`Slope_sa C:/data/dem C:/data/slope PERCENT_RISE`

Scripting syntax
About getting started with writing geoprocessing scripts
Slope_sa (in_raster, out_raster, output_measurement, z_factor)

 Parameter Explanation Data Type in_raster (Required) Input raster. Composite Geodataset out_raster (Required) The raster to be created. Raster Dataset output_measurement (Optional) Determines the measurement units (degrees or percentages) of the output slope data. DEGREE  — The inclination of slope will be calculated in degrees. PERCENT_RISE  — Keyword to output the percent rise, also referred to as the percent slope. String z_factor (Optional) The number of ground x,y units in one surface z unit. The z-factor adjusts the units of measure for the z units when they are different from the x,y units of the input surface. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface. If the x,y units and z units are in the same units of measure, the z-factor is 1. This is the default. If the x,y units and z units are in different units of measure, the z-factor must be set to the appropriate factor, or the results will be incorrect. For example, if your z units are feet and your x,y units are meters, you would use a z-factor of 0.3048 to convert your z units from feet to meters (1 foot = 0.3048 meter). Double

Data types for geoprocessing tool parameters

### Script example

```# Slope_sample.py
# Description:
#   Derives slope from a raster surface.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005
# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

try:
# Set local variables
InRaster = "C:/data/dem"
OutRaster = "C:/data/slope"
InMeasurementType = "PERCENT_RISE"

# Check out ArcGIS Spatial Analyst extension license
gp.CheckOutExtension("Spatial")

# Process: Slope
gp.Slope_sa(InRaster, OutRaster, InMeasurementType)

except:
# If an error occurred while running a tool, then print the messages.
print gp.GetMessages()
```

Map Algebra syntax
Slope(<grid>, {DEGREE | PERCENTRISE})

Slope(<grid>, <z_factor>, {DEGREE | PERCENTRISE})

 Parameter Explanation Any valid combination of rasters, numbers, operators, and functions that produces an output raster. {DEGREE | PERCENTRISE} Keywords specifying the units in which the value of slope will be expressed. DEGREE  — The inclination of slope will be calculated in degrees. PERCENTRISE  — Keyword to output the percent rise, also referred to as the percent slope. The number of ground x,y units in one surface z unit. The z-factor adjusts the units of measure for the z units when they are different from the x,y units of the input surface. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface. If the x,y units and z units are in the same units of measure, the z-factor is 1. This is the default. If the x,y units and z units are in different units of measure, the z-factor must be set to the appropriate factor or the results will be incorrect. For example, if your z units are feet and your x,y units are meters, you would use a z-factor of 0.3048 to convert your z units from feet to meters (1 foot = 0.3048 meters).

### Map Algebra example

```slope(ingrid)
slope(ingrid, percentrise)
slope(ingrid, .328)
slope(ingrid, degree, 2)```

ArcObjects syntax
ISurfaceOp::Slope (geoDataset As IGeoDataset, slopeType As esriGeoAnalysisSlopeEnum, [zFactor As Variant]) As IGeoDataset

 Parameter Explanation geoDataset An input Raster, RasterDataset, RasterBand, or RasterDescriptor. slopeType EsriGeoAnalysisSlopeEnum  — Specifies the units in which the value of slope will be expressed. EsriGeoAnalysisSlopeDegree  — Indicates to calculate the inclination of slope in degrees. EsriGeoAnalysisSlopePercentrise  — Indicates to output the percent rise, also referred to as the percent slope. zFactor The number of ground x,y units in one surface z unit. The z-factor adjusts the units of measure for the z units when they are different from the x,y units of the input surface. The z-values of the input surface are multiplied by the z-factor when calculating the final output surface. If the x,y units and z units are in the same units of measure, the z-factor is 1. This is the default. If the x,y units and z units are in different units of measure, the z-factor must be set to the appropriate factor or the results will be incorrect. For example, if your z units are feet and your x,y units are meters, you would use a z-factor of 0.3048 to convert your z units from feet to meters (1 foot = 0.3048 meters).

### ArcObjects example

```' Create the RasterSurfaceOp object
Dim pSurfaceOp As ISurfaceOp
Set pSurfaceOp = New RasterSurfaceOp

' Declare the input raster object
Dim pInputDataset As IGeoDataset

' Calls function to open a raster dataset from disk
Set pInputDataset = OpenRasterDataset ("D:\SpatialData", "inputdataset")

' Declare the output raster object
Dim pOutputRaster As IGeoDataset

' Calls the method
Set pOutputRaster = pSurfaceOp.Slope (pInputDataset, esriGeoAnalysisSlopeDegrees)
```

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.