HowTo:  Add individual raster bands from a multiband raster to the Extract Multi Values to Points tool using Python

相关信息
Article ID: 41145
Software:
ArcGIS - ArcEditor 10
ArcGIS - ArcInfo 10
ArcGIS - ArcView 10
ArcGIS for Desktop Advanced 10.1
ArcGIS for Desktop Standard 10.1
ArcGIS for Desktop Basic 10.1
Platforms: N/A

问题描述
The instructions provided describe how to add individual raster bands from a multiband raster to the Extract Multi Values to Points geoprocessing tool using Python.



This article can be used as a workaround for the bug #NIM085128 - The Extract Multi Values to Points tool reports only the first band and repeats the value for subsequent bands at 10.1, when the input is a multiband raster.

已邀请:

易智瑞技术支持

赞同来自:

解决方案
Below is a code sample to add individual raster bands from a multiband raster to the Extract Multi Values to Points geoprocessing tool. This is a standalone script that can be run outside of ArcMap.



import arcpy, os
from arcpy.sa import *
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

multibandRaster = r'C:\arcgis\ArcTutor\Raster\Data\Amberg_tif\090160.tif'
desc = arcpy.Describe(multibandRaster)
bands = desc.bandCount
inPointFeatures = r"C:\arcgis\ArcTutor\Raster\Data\points.shp"
in_rasters = []

for band in desc.children:
bandName = band.name
#append each band to the in_rasters list
in_rasters.append(os.path.join(multibandRaster, bandName))

# Execute ExtractValuesToPoints
ExtractMultiValuesToPoints(inPointFeatures, in_rasters)




其它相关参考
  1. Bug NIM085128


创建及修改时间
Created: 5/2/2013

Last Modified: 8/6/2013
原文链接
http://support.esri.com/en/kno ... 41145

要回复问题请先登录注册