Solved

ArcSDE Geodb Writer - Write existing features to attributed relationship class

  • 13 September 2016
  • 5 replies
  • 22 views

Badge +4

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

icon

Best answer by fmelizard 15 September 2016, 00:50

View original

5 replies

Userlevel 4
Badge +13

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.

Badge +4

Hi,

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

Userlevel 4
Badge +13

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

Badge +4

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

Userlevel 4
Badge +13

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!

 

Reply