ArcGIS教程:多值提取至点 (空间分析)

  摘要

  在点要素类的指定位置提取一个或多个栅格像元值,并将值记录到点要素类的属性表中。

  用法

  · 可以将任意栅格组合(单波段或多波段)指定为输入。

  · 将为每个输入栅格提取一个像元值,并会将包含该提取值的新字段追加到输入点要素类。

  · 默认情况下,将根据输入栅格的名称来创建输出字段的名称。或者您也可以为每个存储栅格值的字段指定唯一名称。

  · 当输入多波段栅格数据时,为所有波段添加的输出字段的名称中将包含指示波段号的 “b1_, b2_, …bn” 前缀。

  · 插值选项决定了从栅格中获取值的方式。默认选项为使用被采样像元的中心值。插值选项将使用双线性插值法在像元中心内插一个值。

  · Shapefile 格式的字段最大长度限制为 10 个字符。默认情况下,追加到输入 shapefile 的输出字段将被截断并获得唯一值。如果名称很长或很相似,则可能很难区分各输入栅格。在这种情况下,建议您将要素转换为文件地理数据库。

  · 栅格中的 NoData 像元将被赋予空值。shapefile 不支持空值,而是将其赋予 0(零)值。

  · 不支持将多点数据集作为输入。

  代码实例

  多值提取至点 (ExtractMultiValuesToPoints) 示例 1(Python 窗口)

  将多个栅格的像元值提取到 shapefile 点要素类的属性中。

  import arcpy

  from arcpy.sa import *

  from arcpy import env

  env.workspace = “c:/sapyexamples/data”

  ExtractMultiValuesToPoints(“observers.shp”, [[“elevation”, “ELEV”],

  [“costraster”, “COST”], [“flowdir”, “DIR”]], “NONE”)

  多值提取至点 (ExtractMultiValuesToPoints) 示例 2(独立脚本)

  使用插值法将多个栅格的像元值提取到 shapefile 点要素类的属性中。

  # Name: ExtractMultiValuesToPoints_Ex_02.py

  # Description: Extracts the cells of multiple rasters as attributes in

  # an output point feature class. This example takes a multiband IMG

  # and two GRID files as input.

  # 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

  inPointFeatures = “poi.shp”

  inRasterList = [[“doqq.img”, “doqqval”], [“redstd”, “focalstd”],

  [“redmin”, “focalmin”]]

  # Check out the ArcGIS Spatial Analyst extension license

  arcpy.CheckOutExtension(“Spatial”)

  # Execute ExtractValuesToPoints

  ExtractMultiValuesToPoints(inPointFeatures, inRasterList, “BILINEAR”)

转载自:https://blog.csdn.net/dsac1/article/details/49128053

You may also like...

退出移动版