ArcGIS教程:分水岭

  摘要

  确定栅格中一组像元之上的汇流区域。

  使用方法

  · 各个分水岭的值将取自输入栅格中源的值或者要素倾泻点数据。假设倾泻点为栅格数据集,则使用像元值。假设倾泻点为点要素数据集,则从指定的字段中获取值。

  · 假设预先使用捕捉倾泻点工具将倾泻点定位至累积流量大的像元,将得到更加理想的结果。

  · 当指定输入倾泻点位置作为要素数据时,默认字段将为首个可用的有效字段。假设不存在有效字段,则 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")

原文地址:https://www.cnblogs.com/yangykaifa/p/6852713.html