Feature class to feature class join, relation type many to many

01-26-2022 09:43 PM
New Contributor II

I want to create a tool to Join point and line features on session base environment without a new output (output feature class), for example, Tower and electric Line.

electric line is spitted on every tower. the relation is many to may.

The related feature can be within 0.8meter.

Anyone can help regarding this without creating a new output feature class?.

Please share the code for this process 

Thanks & Regards,

0 Kudos
2 Replies
Occasional Contributor III

If you absolutely have to use the same feature class I would use this scary method. BEFORE STARTING, BACK UP YOUR DATABASE FIRST AND ENSURE A RESTORE IS POSSIBE. Also I would experiment with a copy of your original data in a test environment or a file geodatabase before proceeding to a full implementation in production. Data safety is concern number one. That being said. 

1. Use the "Split Line at Point" tool to create a new feature class. This should pretty much be the end result you want with the exception that it's a new feature class. You can stop here if you can use a different feature class, if not here is where the scary comes in...I almost hesitate to suggest it, so make sure you have a backup of the original data. If you have any concerns don't do it. 

2. Select all line features in your original feature class and delete them. This will leave an "empty" feature class with all your attributes defined as you want them.  Deleting all your lines will be scary. 

3. Use the "Load Data" tool in the Catalog Pane to load the lines from the feature class resulting from the "Split Line at Point" tool into the now empty original feature class. You'll have to use field mapping to match the fields up between the two, but that should be pretty easy since the fields should have the same names in both files. 

Another note of caution here is that if you have related features linked to the original lines feature class, or other third party software linking to the lines, deleting all of those lines could have unpredictable and very negative consequences. 

The only other way I can think of is to either program it in Arcpy or build it in Model Builder.  Either way you'll want to iterate through your points, going to each one, selecting the closest line to your point (using your search tolerance), and splitting the line at the point. Also something you should do in a test environment first after backing up your database. 

New Contributor II

Thanks for your reply,

Yes, it is only possible by customization ArcPy, or any other language. 

Manual procedure is to select both features point and lines then from attribute window Add selected for the relation.


0 Kudos