Watershed (Raster Analysis)

Summary

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

Illustration

Watershed tool illustration

Usage

  • This raster analysis portal tool is available when you are signed in to an ArcGIS Enterprise Link to Understanding analysis in ArcGIS Enterprise portal that has an ArcGIS Image Server Link to What is ArcGIS Image Server configured for Raster Analysis Link to Configure and deploy raster analytics. When the tool is invoked, ArcGIS Pro serves as a client and the processing happens in the servers federated with ArcGIS Enterprise. The portal tool accepts layers from your portal as input and creates output in your portal.

    The input raster layer supports the following: a layer from the portal, a URI or URL to an image service, or the output from the Make Image Server Layer tool. The input feature layer can be a layer from the portal. It can also be a URI or URL to a feature service. This tool does not support local raster data or layers. While you can use local feature data and layers as input to this portal tool, best practice is to use layers from your portal as input.

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

String
pourPointField
(Optional)

Field used to assign values to the pour point locations.

String

Derived Output

NameExplanationData Type
outputRaster

The output raster.

Raster Layer

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

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

Related topics