AnsweredAssumed Answered

vb.net - get layer properties

Question asked by Alberto on Feb 23, 2015
Latest reply on Feb 24, 2015 by Alberto

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

Outcomes