Watershed (Raster Analysis)

Titleā€ƒ Watershed (Raster Analysis)

Summary

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


Illustration

Watershed tool 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

Parameter Explanation
inputFlowDirectionRaster

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

inPourPointRasterOrFeatures

The input pour point locations.

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 prompted to provide another name.

pourPointField (Optional)

Field used to assign values to the pour point locations.

Code Samples

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)
                    

Tags

Credits

Use limitations