vb.net - get layer properties

4188
2
Jump to solution
02-23-2015 07:49 AM
AlbertoLaurenti
New Contributor III

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

0 Kudos
1 Solution

Accepted Solutions
JeffMatson
Occasional Contributor III

It should work if you check for IMosaicLayer instead of IMosaicDataset.

View solution in original post

2 Replies
JeffMatson
Occasional Contributor III

It should work if you check for IMosaicLayer instead of IMosaicDataset.

AlbertoLaurenti
New Contributor III

Thanks Jeff! That's correct!

I've tried with IMosaicDataset and IMosaicRaster.... missing IMosaicLayer!