Skip To Content

Watershed

Summary

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

Illustration

Watershed tool illustration

Usage

  • The value of each watershed will be taken from the value of the source in the input raster or feature pour point data. When the pour point is a raster dataset, the cell values will be used. When the pour point is a point feature dataset, the values will come from the specified field.

  • The Watershed tool only supports a D8 input flow direction raster. D8 flow directions can be created using the Flow Direction tool, run with default flow direction type D8.

  • When specifying the input pour point locations as feature data, the default field will be the first available valid field. If no valid fields exist, the ObjectID field (for example, OID or FID) will be the default.

Syntax

Watershed_ra (inputFlowDirectionRaster, inPourPointRasterOrFeatures, outputName, {pourPointField})
ParameterExplanationData Type
inputFlowDirectionRaster

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

Raster Layer; Image Service; String
inPourPointRasterOrFeatures

The input pour point locations.

Raster Layer; Feature Layer; Image Service; Feature Service; String
outputName

The name of the output watershed raster service.

The default name is based on the tool name and the input layer name. If the layer already exists, you will be asked to provide another name.

String
pourPointField
(Optional)

Field used to assign values to the pour point locations.

String

Code sample

Watershed example 1 (Python window)

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

import arcpy
arcpy.Watershed_ra("https://myserver/rest/services/flowdir/ImageServer","https://myserver/rest/services/streamlink/ImageServer","outWatershed1")
Watershed example 2 (stand-alone script)

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

#---------------------------------------------------------------------------
# Name: Watershed_example02.py
# Requirements: ArcGIS Image Server

# Import system modules
import arcpy

# Set local variables
inFlowDirection = "https://myserver/rest/services/flowdir/ImageServer"
inPourPoint = "https://myserver/rest/services/streamlink/ImageServer"
outputWatershed = "outWatershed2"

# Execute Watershed raster analysis tool
arcpy.Watershed_ra(inFlowDirection, inPourPoint, outputWatershed)

Licensing information

  • ArcGIS Desktop Basic: Requires ArcGIS Image Server
  • ArcGIS Desktop Standard: Requires ArcGIS Image Server
  • ArcGIS Desktop Advanced: Requires ArcGIS Image Server

Related topics