Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have two tables in a geodatabase:

  • parcel; and
  • person

1 or + parcel, can have 1 or + person (relationship is many-to-many)

Using VB.NET I can display all the parcel labelled with the "id" field (see picture on left).

What I want is to display the parcel with labels for the Names of their persons (see picture on right):

enter image description here

I think that I have to use join between two tables

I can get the name with this code

 Sub addNom()
        ' Open the origin and destination classes.
        Dim featureWorkspace As IFeatureWorkspace = CType(Sp, IFeatureWorkspace)
        Dim originClass As IFeatureClass = featureWorkspace.OpenFeatureClass("parcelle")
        Dim destinationClass As IObjectClass = CType(featureWorkspace.OpenTable("personne"), IObjectClass)

        ' Create a memory relationship class factory and open a relationship class with it.
        Dim relClassFactoryType As Type = Type.GetTypeFromProgID("esriGeodatabase.MemoryRelationshipClassFactory")
        Dim memRelClassFactory As IMemoryRelationshipClassFactory = CType(Activator.CreateInstance(relClassFactoryType), IMemoryRelationshipClassFactory)
        Dim memRelClass As IRelationshipClass = memRelClassFactory.Open("pll_personne", originClass, "id", _
                                                destinationClass, "id", "Contains", "Is in", esriRelCardinality.esriRelCardinalityOneToMany)

        ' Find the counties related to the state with an ObjectID of 1.
        Dim originFeature As IFeature = originClass.GetFeature(6)
        Dim relatedSet As ISet = memRelClass.GetObjectsRelatedToObject(originFeature)

        ' Iterate through the set while finding the names of the counties.
        Dim nameIndex As Integer = destinationClass.FindField("nom_fr")
        Dim setObject As Object = relatedSet.Next()
        While Not setObject Is Nothing
            Dim row As IRow = CType(setObject, IRow)
            Console.WriteLine("OID: {0}, NAME: {1}", row.OID, row.Value(nameIndex))
            setObject = relatedSet.Next()
        End While
    End Sub

The Question is:

How can I display the labels using this result?

share|improve this question
You could take a look at the AnnotationFeature object. From what I know about it, the IAnnotationFeature interface lets you build your own annotation.… and… – travis Jun 27 '13 at 8:00

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.