ArcGIS教程:用点提取 (空间分析)

  摘要

  基于一组坐标点提取栅格像元。

  用法

  · 未选择的像元位置被赋予 NoData 值。

  · 当输入为多波段栅格时,将输出一个新的多波段栅格。对输入多波段栅格中的每一单个波段都会进行相应分析。

  默认输出格式是 Esri Grid 堆栈。请注意,Esri Grid 堆栈的名称不能以数字开头、不能使用空格,并且长度不能超过 9个字符。

  · 如果输入内容为根据多波段栅格(超过三个波段)创建的图层,提取操作将只考虑图层加载(符号化)的波段。因此,输出的多波段栅格只会具有三个波段,分别对应于输入图层显示中使用的多波段栅格。

  · 如果输入栅格为整型,那么输出栅格也为整型。如果输入栅格为浮点型,则输出栅格也为浮点型。

  代码实例

  用点提取 (ExtractByPoints) 示例 1(Python 窗口)

  本示例将基于指定点坐标提取栅格的像元。

  import arcpy

  from arcpy import env

  from arcpy.sa import *

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

  pointList = [arcpy.Point(743050, 4321275), arcpy.Point(743100, 4321200),

  arcpy.Point(734500,4322000)]

  outPointExtract = ExtractByPoints(“soil”, pointList,”INSIDE”)

  outPointExtract.save(“c:/sapyexamples/output/pntextract”)

  用点提取 (ExtractByPoints) 示例 2(独立脚本)

  本示例将基于指定点坐标提取栅格的像元。

  # Name: ExtractByPoints_Ex_02.py

  # Description: Extracts the cells of a raster based on a set of points.

  # 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

  inRaster = “soil”

  pointList = [arcpy.Point(743050, 4321275),

  arcpy.Point(743100, 4321200),

  arcpy.Point(743500, 4322000),

  arcpy.Point(742900, 4321800)]

  # Check out the ArcGIS Spatial Analyst extension license

  arcpy.CheckOutExtension(“Spatial”)

  # Execute ExtractByPoints

  outPointExtract = ExtractByPoints(“soil”, pointList,”INSIDE”)

  # Save the output

  outPointExtract.save(“c:/sapyexamples/output/pntext”)

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

You may also like...

退出移动版