Metadata In ArcMap TOC


Illustrates how metadata can be used with datasets in ArcMap. For each layer that is loaded into ArcMap, an element from the layer's metadata is displayed in the Table of Contents next to the layer's name. The user specifies the metadata element that is displayed from a dialog box that is implemented as an ArcMap Command button.

How to use:

    Steps for adding a command/tool from a DLL:

  1. Register this sample's dll by compiling the sample or by using Regsvr32.exe.
  2. In the Customize dialog, click on 'Add from file' and select this sample's dll.
  3. Under the Commands tab, select the Metadata In TOC command from the Developer Samples category, and drag it on to a toolbar. Dismiss the Customize dialog.
  4. Click the new 'Metadata in TOC' button. This will open a dialog box - click the 'Yes' option button to enable metadata display in the TOC, and click 'OK' to close the dialog.
  5. Add some data to ArcMap. If the dataset you added has metadata, then you'll see content from the metadata written next to the dataset's name in ArcMap (the default setting is to show the dataset's status). If the dataset has no metadata, then the words <not present> will be shown instead. (If the data format does not support metadata, then nothing is shown for that layer).


Requires: Any dataset that has metadata created through ArcCatalog.

Difficulty: Intermediate

Visual Basic
File Description
Description.htm Describes all components of the project in detail.
MetadataInTOC.cls Code that implements the ArcMap command button interface.
MetadataInTOC.frm The dialog displayed in ArcMap used to control what is shown in the TOC.
MetadataInTOC.vbp Visual Basic 6 project file.
MetadataInTOC.dll Compiled output DLL.
globals.bas Global variables and shared code.
meta.res Resource file containing image used for command button icon.

Key CoClasses: Name, MxDocument
Key Interfaces: IDataLayer, IMetadata, IPropertySet, IMxDocument, IContentsView
Key Members: IDataLayer::DataSourceName, IMetadata::Metadata, IPropertySet::GetProperty, IMxDocument::CurrentContentsView