Available with Spatial Analyst license.
Summary
Snaps pour points to the cell of highest flow accumulation within a specified distance.
Usage
The Snap Pour Point tool is used to ensure the selection of points of high accumulated flow when delineating drainage basins using the Watershed tool. Snap Pour Point will search within a snap distance around the specified pour points for the cell of highest accumulated flow and move the pour point to that location.
If the input pour point data is a point feature class, it will be converted to a raster internally for processing.
The output is an integer raster when the original pour point locations have been snapped to locations of higher accumulated flow.
When there is only one input pour point location, the extent of the output is that of the accumulation raster. If there is more than one pour point location, the extent of the output is determined by the settings in the Output extent environment.
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.
See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.
Syntax
SnapPourPoint(in_pour_point_data, in_accumulation_raster, snap_distance, {pour_point_field})
Parameter | Explanation | Data Type |
in_pour_point_data | The input pour point locations that are to be snapped. For a raster input, all cells that are not NoData (that is, have a value) will be considered pour points and will be snapped. For a point feature input, this specifies the locations of cells that will be snapped. | Raster Layer; Feature Layer |
in_accumulation_raster | The input flow accumulation raster. This can be created with the Flow Accumulation tool. | Raster Layer |
snap_distance | Maximum distance, in map units, to search for a cell of higher accumulated flow. | Double |
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
Name | Explanation | Data Type |
out_raster | The output pour point raster where the original pour point locations have been snapped to locations of higher accumulated flow. This output is of integer type. | Raster |
Code sample
SnapPourPoint example 1 (Python window)
This example snaps pour points to the cell of highest flow accumulation within a specified distance.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outSnapPour = SnapPourPoint("pourpoint", "flowaccumulation.img", 5,"VALUE")
outSnapPour.save("c:/sapyexamples/output/outsnpprpnt01")
SnapPourPoint example 2 (stand-alone script)
This example snaps pour points to the cell of highest flow accumulation within a specified distance.
# Name: SnapPourPoints_Ex_02.py
# Description: Snaps pour points to the cell of highest
# flow accumulation within a specified distance.
# 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
inPourPoint = "pourpoint"
inFlowAccum = "flowaccumulation.img"
tolerance = 5
pourField = "VALUE"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute SnapPourPoints
outSnapPour = SnapPourPoint(inPourPoint, inFlowAccum, tolerance,
pourField)
# Save the output
outSnapPour.save("c:/sapyexamples/output/outsnpprpnt02")
Environments
Licensing information
- Basic: Requires Spatial Analyst
- Standard: Requires Spatial Analyst
- Advanced: Requires Spatial Analyst