Watershed (Spatial Analyst)

License Level:BasicStandardAdvanced

Summary

Determines the contributing area above a set of cells in a raster.

Learn more about how Watershed works

Usage

Syntax

Watershed (in_flow_direction_raster, in_pour_point_data, {pour_point_field})
ParameterExplanationData Type
in_flow_direction_raster

The input raster that shows the direction of flow out of each cell.

The flow direction raster can be created using the Flow Direction tool.

Raster Layer
in_pour_point_data

The input pour point locations.

For a raster, this represents cells above which the contributing area, or catchment, will be determined. All cells that are not NoData will be used as source cells.

For a point feature dataset, this represents locations above which the contributing area, or catchment, will be determined.

Raster Layer | Feature Layer
pour_point_field
(Optional)

Field used to assign values to the pour point locations.

If the pour point dataset is a raster, use Value.

If the pour point dataset is a feature, use a numeric field. If the field contains floating-point values, they will be truncated into integers.

Field

Return Value

NameExplanationData Type
out_raster

The output raster that shows the contributing area.

It will be of integer type.

Raster

Code Sample

Watershed example 1 (Python window)

This example determines the contributing area for selected pour point locations on a flow direction GRID raster.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outWatershed = Watershed("flowdir", "pourpoint")
outWatershed.save("C:/sapyexamples/output/outwtrshd01")
Watershed example 2 (stand-alone script)

This example determines the contributing area for selected pour point locations on a flow direction GRID raster and outputs the watershed as a TIFF raster.

# Name: Watershed_Ex_02.py
# Description: Determines the contributing area above a set of cells in a
#     raster.
# Requirements: Spatial Analyst Extension

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

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

# Set local variables
inFlowDirection = "flowdir"
inPourPointData = "pourpoint"
inPourPointField = "VALUE"

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

# Execute Watershed
outWatershed = Watershed(inFlowDirection, inPourPointData, inPourPointField)

# Save the output 
outWatershed.save("C:/sapyexamples/output/outwtrshd02.tif")

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Requires Spatial Analyst
ArcGIS for Desktop Standard: Requires Spatial Analyst
ArcGIS for Desktop Advanced: Requires Spatial Analyst
4/10/2014