Hi,
I wrote this code to loop in my TOC:
Dim iLyrIndex As Long
Dim layer As ILayer
Dim geoDataset As IGeoDataset
' Add raster layers into Combobox
Dim iLayerCount As Integer
iLayerCount = map.LayerCount
If iLayerCount > 0 Then
For iLyrIndex = 0 To iLayerCount - 1
layer = map.Layer(iLyrIndex)
If (TypeOf layer Is IRasterLayer) Or (TypeOf layer Is IMosaicDataset) Or (TypeOf layer Is IRasterCatalogLayer) Or (TypeOf layer Is IGdbRasterCatalogLayer) Then
cboBox.Items.Add(layer.Name) ' <---- mosaic dataset DO NOT shows here!
Else
MsgBox(layer.Name) ' <---- mosaic dataset shows here!
End If
Next iLyrIndex
End If
The code works well with raster layer and raster catalogs, but not with raster mosaic dataset.
If I double-click on the mosaic dataset in the TOC (grouping the Boundary, Footprint and Image layers) and then the "Source" tab in the Layer Properties Dialog the Data Type is Mosaic Dataset.
So, what's wrong? Please, any help?
Thanks a lot in advance
Solved! Go to Solution.
It should work if you check for IMosaicLayer instead of IMosaicDataset.
It should work if you check for IMosaicLayer instead of IMosaicDataset.
Thanks Jeff! That's correct!
I've tried with IMosaicDataset and IMosaicRaster.... missing IMosaicLayer!