Skip to main content
Solved

ArcSDE Geodb Writer - Write existing features to attributed relationship class

  • September 13, 2016
  • 5 replies
  • 41 views

arxit
Contributor
Forum|alt.badge.img+5
  • Contributor

Hi,

I'm trying to write existing features into a relationship class with the new SDE writer. My source and destination features already exist, and I want to populate the relationship class with the known PK of each features, but it seems impossible with this writer. I follow this article : https://knowledge.safe.com/articles/28340/working-with-geodatabase-relationship-classes-atta.html, but it seems we can only write to relationship class if we also write the corresponding features in their tables.

Is there any way to write to a relationship class like a regular table?

Thanks

Best answer by fmelizard

Hello @arxit - I was incorrect, if you have an attributed or M:N (attributed or not) relationship which is already set up in the database, and you have the features that participate in the relationship already loaded, you use FME to build the relationships and insert them into the relationship table without writing the features. In order to do this you need to get the OBJECTID's for the feature classes that participate in the relationship (read the feature classes in) and set the OBJECTID from your origin feature class to the geodb_rel_origin_oid and the OBJECTID from the destination feature class to geodb_rel_destination_oid. You also need to make sure you have the geodb_type attribute set to geodb_relationship or geodb_attributed_relationship. This method only works with the OBJECTID's. I hope this makes sense and sorry for the incorrect information at first. My tests yesterday involved foreign and primary keys (which won't work this way), not OBJECTID's. I have uploaded an example workspace showing the attributes which need to be set.simplemnrelationshipsample.fmw

View original
Did this help you find an answer to your question?

5 replies

fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • September 13, 2016

Hello @arxit - Currently with the SDE geodatabase writer, you do need to have the features which participate in the relationship coming in and being written at the same time as you are writing to the relationship table. It has to validate those relationships.


arxit
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • September 14, 2016

Hi,

Is this in the roadmap, so we can only use 1 writer to write to feature class and also existing relationships?


fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • Best Answer
  • September 14, 2016

Hello @arxit - I was incorrect, if you have an attributed or M:N (attributed or not) relationship which is already set up in the database, and you have the features that participate in the relationship already loaded, you use FME to build the relationships and insert them into the relationship table without writing the features. In order to do this you need to get the OBJECTID's for the feature classes that participate in the relationship (read the feature classes in) and set the OBJECTID from your origin feature class to the geodb_rel_origin_oid and the OBJECTID from the destination feature class to geodb_rel_destination_oid. You also need to make sure you have the geodb_type attribute set to geodb_relationship or geodb_attributed_relationship. This method only works with the OBJECTID's. I hope this makes sense and sorry for the incorrect information at first. My tests yesterday involved foreign and primary keys (which won't work this way), not OBJECTID's. I have uploaded an example workspace showing the attributes which need to be set.simplemnrelationshipsample.fmw


arxit
Contributor
Forum|alt.badge.img+5
  • Author
  • Contributor
  • September 15, 2016

Good this worked!

Actually I have my relationships based on GlobalIDs, so I need the corresponding OBJECTIDs to enter the writer. It's tricky but it works.

Thanks


fmelizard
Safer
Forum|alt.badge.img+18
  • Safer
  • September 16, 2016
arxit wrote:

Good this worked!

Actually I have my relationships based on GlobalIDs, so I need the corresponding OBJECTIDs to enter the writer. It's tricky but it works.

Thanks

Great @arxit - I'm glad it worked for you!

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings