English

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

Summary

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.

Note:
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.

Procedure

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.


Code:
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)

Related Information