HOW TO

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

Last Published: April 25, 2020

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)

Article ID:000011794

Software:
  • ArcMap

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic