Hi,
I want to write a piece of code (ArcObjects 10.3 c#) to check if a layer in table of contents in ArcGIS is raster. Can someone help me please.
Thanks
Masroor
Here's VB.NET code (from an add-in) that will cycle through each layer in your map and do something if it's a raster
Dim pEnumLayers As ESRI.ArcGIS.Carto.IEnumLayer Dim pLayer As ESRI.ArcGIS.Carto.ILayer If My.ArcMap.Document.FocusMap.LayerCount > 0 Then pEnumLayers = My.ArcMap.Document.FocusMap.Layers pLayer = pEnumLayers.Next Do Until pLayer Is Nothing If pLayer.Valid Then If TypeOf pLayer Is ESRI.ArcGIS.Carto.IRasterLayer Then ' do something End If End If pLayer = pEnumLayers.Next Loop End If
Hi, first to get the layer index from layer name if that's not already known, using snippet like http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//0049000000ns000000 , then check if it is ESRI.ArcGIS.Carto.IRasterLayer, similar to this snippet http://resources.arcgis.com/en/help/arcobjects-net/componenthelp/index.html#//004900000076000000
Hope this is what you are asking?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.