Watershed

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

Learn more about how Watershed works


Usage tips

Command line and Scripting

Map Algebra

ArcObjects

Syntax

Watershed_sa (in_flow_direction_raster, in_pour_point_data, out_raster, pour_point_field)
Parameter Explanation Datatype
Input flow direction raster (Required)

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

This can be created with the Flow Direction function.

Composite Geodataset
Input raster or feature pour point data (Required)

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 feature dataset, this represents locations above which the contributing area, or catchment, will be determined.

Composite Geodataset
Output raster (Required)

The raster to be created.

Raster Dataset
Pour point field (Optional)

Field used to assign values to the pour point locations.

If in_pour_point_data is raster, use Value.

If in_pour_point_data is feature, use the first numeric field.

Field
Data types for geoprocessing tool parameters

Script Example

# Watershed_sample.py
# Description: 
#   Determines the contributing area above a set of cells in a raster.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005

# Import system modules
import arcgisscripting

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

try:
    # Set local variables
    InFlowDirectionRaster = "C:/data/flowdir"
    InPourPointRaster = "C:/data/pourpoint"
    OutRaster = "C:/data/watershed"

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

    # Process: Watershed
    gp.Watershed_sa(InFlowDirectionRaster, InPourPointRaster, OutRaster)

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

Map Algebra syntax

Watershed(<dir_grid>, <source_grid>)

Parameter Explanation
<dir_grid> A raster showing direction of flow out of each cell. This can be created using the FlowDirection function.
<source_grid> A raster representing cells above which the contributing area, or catchment, will be determined. All cells that are not NoData will be used as source cells.

Map Algebra example

watershed(dirgrid, stations)
watershed(flowdirection(elev), dams)

ArcObjects syntax

IHydrologyOp::Watershed (directionRaster As IGeoDataset, sourceDataset As IGeodataset) As IGeoDataset

Parameter Explanation
directionRaster An input Raster, RasterDataset, RasterBand, or RasterDescriptor showing the direction of flow out of each cell. This can be created using the IHydrologyOp::FlowDirection method.
sourceDataset An input Raster, RasterDataset, RasterBand, RasterDescriptor, FeatureClass, or FeatureClassDescriptor representing cells above which the contributing area, or catchment, will be determined. If a raster, all cells that are not NoData will be used as source locations.

ArcObjects example

' Create the RasterHydrologyOp object
Dim pHydrologyOp As IHydrologyOp
Set pHydrologyOp = New RasterHydrologyOp

' Declare the input direction raster object
Dim pDirection As IGeoDataset

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

' Declare the input source raster object
Dim pSource As IGeoDataset

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

' Declare the output raster object
Dim pOutputRaster As IGeoDataset

' Calls the method
Set pOutputRaster = pHydrologyOp.WaterShed (pDirection, pSource)

See Also

  • Flow Direction
  • Stream Order
  • An overview of the Hydrology tools