摘要
確定柵格中一組像元之上的匯流區域。
使用方法
· 各個分水嶺的值將取自輸入柵格中源的值或者要素傾瀉點數據。假設傾瀉點為柵格數據集,則使用像元值。假設傾瀉點為點要素數據集,則從指定的字段中獲取值。
· 假設預先使用捕捉傾瀉點工具將傾瀉點定位至累積流量大的像元,將得到更加理想的結果。
· 當指定輸入傾瀉點位置作為要素數據時,默認字段將為首個可用的有效字段。假設不存在有效字段,則 ObjectID 字段(如 OID 或 FID)將為默認字段。
語法
Watershed (in_flow_direction_raster, in_pour_point_data, {pour_point_field})
代碼實例
Watershed 演示樣例 1(Python 窗體)
本演示樣例針對流向 GRID 柵格中選定的傾瀉點位置確定匯流區域。
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outWatershed = Watershed("flowdir", "pourpoint")
outWatershed.save("C:/sapyexamples/output/outwtrshd01")
Watershed 演示樣例 2(獨立腳本)
本演示樣例針對流向 GRID 柵格中選定的傾瀉點位置確定匯流區域,並以 TIFF 柵格的形式輸出分水嶺。
# Name: Watershed_Ex_02.py
# Description: Determines the contributing area above a set of cells in a
# raster.
# 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
inFlowDirection = "flowdir"
inPourPointData = "pourpoint"
inPourPointField = "VALUE"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute Watershed
outWatershed = Watershed(inFlowDirection, inPourPointData, inPourPointField)
# Save the output
outWatershed.save("C:/sapyexamples/output/outwtrshd02.tif")