Skip To Content

Aspect (Spatial Analyst)

Available with Spatial Analyst license.

Available with 3D Analyst license.


Derives the aspect from each cell of a raster surface.

The aspect identifies the compass direction that the downhill slope faces for each location.

Learn more about how Aspect works


Aspect illustration
OutRas = Aspect(InRas1)


  • This tool uses a 3 by 3 cell moving window to process the data. If the processing cell is NoData, the output for that location will be NoData.

  • Of the eight cells neighboring the processing cell, this tool requires that at least seven of them have a valid value. If there are fewer than seven valid cells, the calculation will not be performed, and the output at that processing cell will be NoData.

  • The cells in the outermost rows and columns of the output raster will be NoData. This is because along the boundary of the input dataset, those cells do not have enough valid neighbors.

  • Aspect is expressed in positive degrees from 0 to 360, measured clockwise from north.

  • Cells in the input raster that are flat—with zero slope—are assigned an aspect of -1.

  • For the geodesic method, specifying the surface z-unit is important to ensure the accuracy of the output. The Z unit parameter will be enabled only when the geodesic method is selected.

  • If a z-unit is available in the vertical coordinate system of the input raster, it will be applied automatically. It is suggested that you define a z-unit for the input raster if it is missing. You can use the Define Projection tool to specify a z-unit. If it is undefined, meter will be used by default.

  • When the input raster needs to be resampled, the bilinear technique will be used. An example of when an input raster may be resampled is when the output coordinate system, extent, or cell size is different from that of the input.

  • This tool can be GPU accelerated when calculating geodesic aspect. This means that if a GPU device (graphics processing unit) is available on your system, it can be used to enhance the performance of the geodesic method.

    The GPU Processing with Spatial Analyst help topic has more details on configuring and working with GPU devices, and some troubleshooting tips should you encounter difficulties.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.


Aspect(in_raster, {method}, {z_unit})
ParameterExplanationData Type

The input surface raster.

Raster Layer

Determines whether to calculate the aspect based on a planar (flat earth) or a geodesic (ellipsoid) method.

  • PLANARThe calculation will be performed on a projected flat plane using a 2D Cartesian coordinate system. This is the default method.
  • GEODESICThe calculation will be performed in a 3D Cartesian coordinate system by considering the shape of earth as an ellipsoid.

The planar method is appropriate to use on local areas in a projection that maintains correct distance and area. It is suitable for analysis that cover areas such cities, counties, or smaller states in area. The geodesic method produces a more accurate result, at the potential cost of an increase in processing time.


Linear unit of vertical z-values.

It is defined by a vertical coordinate system if it exists. If a vertical coordinate system does not exist, the z-unit should be defined from the unit list to ensure correct geodesic computation. By default, Meter would be applied.

  • INCHFor inches (U.S.)
  • FOOTFor feet
  • YARDFor yards (U.S.)
  • MILE_USFor miles (U.S.)
  • NAUTICAL_MILEFor nautical miles
  • MILLIMETERFor millimeters
  • CENTIMETERFor centimeters
  • METERFor meters
  • KILOMETERFor kilometers
  • DECIMETERFor decimeters

Return Value

NameExplanationData Type

The output aspect raster.

It will be floating-point type.


Code sample

Aspect example 1 (Python window)

This example creates an aspect raster from an input surface raster.

import arcpy
from arcpy import env  
from import *
env.workspace = "C:/sapyexamples/data"
outAspect = Aspect("elevation")"C:/sapyexamples/output/outaspect01.img")
Aspect example 2 (stand-alone script)

This example creates an aspect raster from an input surface raster.

# Name:
# Description: Derives aspect from a raster surface.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inRaster = "elevation"
method = "GEODESIC"
zUnit = "FOOT"
# Check out the ArcGIS Spatial Analyst extension license

# Execute Aspect
outAspect = Aspect(inRaster, method, zUnit)

# Save the output"C:/sapyexamples/output/outaspect02")

Licensing information

  • Basic: Requires Spatial Analyst or 3D Analyst
  • Standard: Requires Spatial Analyst or 3D Analyst
  • Advanced: Requires Spatial Analyst or 3D Analyst

Related topics