jenfosch

Automation error sample extraction

Discussion created by jenfosch on Aug 31, 2010
Hi,

I'm relatively new at programming in ArcGIS, and probably making some stupid mistake. Here's my problem: I'm trying to program a tool that basically runs the sample command on a selected raster dataset. I run in to a automation error using the IExtractionOp.Sample method. Any ideas on what's going wrong?
Here's my code:

Dim Imxdocument As Imxdocument
Dim pMap As IStandaloneTableCollection
Dim outputtable As ITable
Set Imxdocument = Application.Document
Set pMap = Imxdocument.FocusMap
Dim thelay As ILayer
Set thelay = Imxdocument.SelectedLayer

If thelay Is Nothing Then
MsgBox "Selecteer de te exporteren raster file"
Exit Sub
End If
Dim thelayer As IRasterLayer
Set thelayer = thelay
Dim pRaster As IRaster
Set pRaster = thelayer.Raster

If Not TypeOf thelay Is IRasterLayer Then
MsgBox "Selecteer de te exporteren raster file"
Exit Sub
End If

Dim pExtractionOp As IExtractionOp
Set pExtractionOp = New RasterExtractionOp

Dim pLocation As IGeoDataset
Set pLocation = pRaster
Dim pBandCol As IGeoDataset
Set pBandCol = pRaster

Set outputtable = pExtractionOp.Sample(pLocation, pBandCol, esriGeoAnalysisResampleBilinear)

Outcomes