One To Many Labels


The One To Many Labels project is for labeling features based on attribute values accessible through one to many relationships. This functionality not yet part of the core ArcGIS software, but for now can be accomplished through this sample code.

The code requires that a query on the related objects be done before labeling each feature, therefore performance will be slower than labeling features with attributes values in the feature class.
ArcEditor: VB6

Platforms: Windows

Requires: Feature data with one to many relationships

Minimum ArcGIS Release: 9.0

How to use:
  1. Double-click on the _Install.bat file in the code directory to register the tool. This batch file will register the dll and add the appropriate classes to the ESRI Annotation Expression Property Pages and ESRI Mx Annotation Expression Parsers categories.
  2. Start ArcMap and add layers to the map that participate in one to many relationships (the layer to label should be the Origin in the relationship).
  3. Access the Properties dialog for the layer and go to the Labels Tab. Click on the Expression button.
  4. Select the OneToMany tab on the Expression dialog. Select the relationship to use and the field(s) you want to label with. If you select two fields, then the strings will be separated by " - ". The resulting label will be stack with one line for each related record.
  5. Click OK to dismiss the EXpression dialog and the Properties dialog. Turn on labeling for the layer.

Download the VB6 files
frmOneToManyProps.frm Form containing the controls for setting the labeling parameters.
OneToManyLabels.cls Class implementing the new expression engine for labeling.
OneToManyParser.cls Class for the AnnotationExpressionParser.
OneToManyProps.cls Class implementing the new property page for one to many labeling.
OneToManyLabelsPrj.vbp Visual Basic project file.

Download the files for all languages

Key CoClasses:LabelEngineLayerProperties, RelationshipClass
Key Interfaces: IAnnotateLayerProperties, IAnnotationExpressionEngine, IAnnotationExpressionParser, IAnnotationExpressionParser2, ICodedValueAttributes, IComPropertyPage, IObjectClass, IRelationshipClass, IRow
Key Members:IAnnotateLayerProperties::FeatureLayer, IAnnotationExpressionEngine::SetExpression, IAnnotationExpressionParser2::FindLabel, IComPropertyPage::SetObjects, IComPropertyPage::Show, IObjectClass::RelationshipClasses, IRelationshipClass::GetObjectsRelatedToObject, IRow::Value