Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

At the moment I've a personal geodatabase with two imported feature classes from shape files and an own created table. This table has columns for the IDs of the elements in the two feature classes. With ArcCatalog I've created two relationship classes between each sfeature class and the table. Both are 1:1 relationsships. Within ArcMap the user can open the table and get access to more detailed informations by using this relationsships (menu -> Related Tables).

Background: One feature class holds features consisting of Polylines, the other features consisting of Points. With the Table I can create a logical relationship between one Point and one Polyline and can add more informations in this table which are only valid for this special relation.

Now I've to work with this table in C# and I've to access the other feature classes too. It's no problem to read the IDs out of the table and start a QueryFilter for the feature class where I need the informations from.

Sure, this is one possible way but there must exist a more efficient way where I can use the relationship classes for faster operations.

Does anybody know how I can query the relationship classes to get all informations at the same time without querying two different tables "manually"?

Thanks a lot!

Edit:

To be more specific. If the table has the two fields ID_EdgeTo and ID_EdgeFrom and one field has a relationship to the feature class EdgesTo and the other to EdgesFrom.

When I get through the rows and see a combination of ID_EdgeTo and ID_EdgeFrom I want to query the relationship classes to get more information for the ID's in this specific row.

Its more about whether the relationship classes are retrievable and how this has to be done. The table in the database has the form like a "manually created" relationship class with relationship attributes

share|improve this question
1  
Are these Simple Relationship Classes or Attributed Relationship Classes? Perhaps if you posted screenshots from the properties dialog in ArcCatalog that would help. –  blah238 Feb 10 '13 at 10:23
    
Both are "normal" Simple Relationship Classes. In ArcMap the user can query the table of the geodatabase using this relationships to get the rows (and the information) displayed from the attribut table of the shape files. –  FredFloete Feb 10 '13 at 10:27
    
When you say shapefiles, you mean feature classes, right? Shapefiles cannot participate in a relationship class (except an in-memory one through RelQueryTable). –  blah238 Feb 10 '13 at 10:29
    
Yes. I've created a personal geodatabase and import the "Shape Files" so the feature classes of the shape files are a part of the geodatabase. I used the terms for a better understanding to get a clear separation between the table created by my own an the imported classes.I hope you understand me right. The selection which the user makes on the user interface in ArcMAP to get the rows and information of out of the feature classes are the steps which I want to perform in C#. In this case for the "easy" example but in the future for more complex cases –  FredFloete Feb 10 '13 at 10:43
    
Always use the most relevant terms for the type of workspace you are talking about. Shapefiles cannot exist in geodatabases, hence my confusion. I understand now though. –  blah238 Feb 10 '13 at 10:50
show 7 more comments

1 Answer

Based on your additional notes it sounds like you will want to use the IRelationshipClass.GetObjectsRelatedToObject method, at least for starters.

For better performance you might consider using one of the other methods, such as GetObjectsRelatedToObjectSet that takes a set of input objects though. This will reduce the number of round trips to the database if you are doing this in batch.

Additionally if you want to specify a QueryFilter over a given set of input objects (this might not be necessary if your cursor is already being filtered), take a look at IRelationshipClass2.GetObjectsMatchingObjectSetEx.

For code examples I would suggest searching the ESRI forums (new and old), as well as this site: Example search

Some relevant results:

Without having a relevant sample dataset I am reluctant to write a code example myself. Perhaps you could upload an ESRI XML Workspace document for a subset of your data, and describe the desired user interaction workflow, inputs and outputs.

Also refer to the available documentation:

Relationship Objects

share|improve this answer
    
Thanks for you reply I know the "Help topic on relationship classes" and the "Creating relationship classes" topic but in my case this two links carry not the information I need. The Object Model Diagrams is a good overview over the interfaces. –  FredFloete Feb 10 '13 at 10:24
add comment

Your Answer

 
discard

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

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