Using ArcObjects, is there a way to programmatically obtain the "friendly name" for a layer's data type as seen in the ArcMap Source tab for layers in a map document?


  • File System Raster
  • Shapefile Feature Class
  • Tiled Internet Layer

Or is this ArcMap-specific code and not exposed to ArcObjects?


This information is provided by the INativeType interface. You can access the native type for a given layer's data source as shown below (I hope you dont mind some VBA, should be easy to follow):

Sub DisplayLayerDataTypeString()

  Dim pDoc As IMxDocument
  Dim pLayer As ILayer
  Dim pDataLayer As IDataLayer
  Dim pDataSourceName As IName
  Dim pNativeTypeInfo As INativeTypeInfo
  Dim pNativeType As INativeType

    Set pDoc = Application.Document
    Set pLayer = pDoc.FocusMap.Layer(0)

    If Not TypeOf pLayer Is IDataLayer Then
      Debug.Print "Not a data layer"
      Exit Sub
    End If

    Set pDataLayer = pLayer
    Set pDataSourceName = pDataLayer.DataSourceName

    If Not TypeOf pDataSourceName Is INativeTypeInfo Then
      Debug.Print "Not a native type data source"
      Exit Sub
    End If

    Set pNativeTypeInfo = pDataSourceName
    Set pNativeType = pNativeTypeInfo.NativeType

    Debug.Print pNativeType.Description

End Sub
  • +1. Very close, but unfortunately this doesn't seem to work on Mosaic Datasets and Tiled Internet Layers (ArcGIS Online basemaps), and possibly others. The descriptions are also slightly less specific than the ones in ArcMap, e.g. "File System Raster" is a "Raster Dataset". Any other suggestions?
    – blah238
    Jul 11 '12 at 10:06
  • Interesting.. I was unable to find anything for base map layers, for example. It can really be internal to ArcObjects after all..
    – Petr Krebs
    Jul 11 '12 at 11:18
  • I could use interface testing for Mosaic Datasets (IMosaicLayer), but I found out that ArcGIS Online tiled basemap layers (like Bing Aerial) implement MapServerLayer but not IMapServerLayer. However I was able to get its CLSID and ProgID: {a4badc1b-ebed-4a29-99dc-c6334de352ad}, esriCarto.InternetTiledLayer.1
    – blah238
    Jul 11 '12 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.