def processJoin(lyr): # Join logistics tables to network fc gp.AddMessage("Joining lrs table...") logFile.write("Joining lrs table...\n") gp.AddJoin_management(lyr, JOIN_FLD, lrs, JOIN_FLD) gp.AddMessage("Joining ltr table...") logFile.write("Joining ltr table...\n") gp.AddJoin_management(lyr, tempFC + "." + JOIN_FLD, ltr, JOIN_FLD) # Copy layer to fc gp.AddMessage("Copying features to feature class...") logFile.write("Copying features to feature class...\n") gp.CopyFeatures_management(lyr, ExportRoadnetwork)
My experience is that CopyFeatures_management is fairly broken if you use it to overwrite an existing feature class. It takes 10-100 times longer than when there is no existing file at the destination.
Are there attribute indices on the two fields in the tables that you are joining?
If you intent is to have a new copy of the original FC, with the fields of the other two tables added, maybe try copying the FC first, then using the JoinField command ArcGIS Desktop
Joins the contents of a table to another table based on a common attribute field. The input table is updated to contain the fields from the join table. You can select which fields from the join table will be added to the input table.
The records in the Input Table are matched to the records in the Join Table based on the values of Input Join Field and the Output Join Field. Optionally, only desired fields can be selected from the Join Table and appended to the Input Table during the join.
The reason I say make a copy first...and work with the copy...is this is a permanent join, vs the add join being temporary. From the sample is 10.0 help..
# PermanentJoin.py # Purpose: Join two fields from a table to a feature class # Author: ESRI # Import system modules import arcpy from arcpy import env # Set the current workspace env.workspace = "c:/data/data.gdb" # Set the local parameters inFeatures = "zion_park" joinField = "zonecode" joinTable = "zion_zoning" fieldList = ["land_use", "land_cover"] # Join two feature classes by the zonecode field and only carry # over the land use and land cover fields arcpy.JoinField_management (inFeatures, joinField, joinTable, joinField, fieldList)