4

I have a fifty or so shapefiles. All of them have similar attribute tables with identical field titles. I also have a standalone table with data that I want to add to every single attribute table based on a shared field (DATE).

This is easy individually using the "Join Field" tool, but on my computer it takes a long time (almost seven minutes per file), and I have to stay near the computer to start the next file.

Is it possible to set it up to run on every single shapefile in the batch? I want to let it run while I'm away from the computer.

0

2 Answers 2

5

Folks usually automate tasks such as yours with Python and the ArcGIS arcpy site package. Here is a script to get you started. This essentially loops over a folder of shapefiles and joins a common table to each. I would recommend creating a copy of your original shapefiles when running this script as the JoinField_management tool alters the original data.

import arcpy

arcpy.env.workspace = r'C:\path\to\your\shapefiles_folder'

join_field = "DATE"
join_table = r'C:\path\to\your\jointable.dbf'
shps = arcpy.ListFeatureClasses()

counter = 1
for shp in shps:
    arcpy.JoinField_management(shp, join_field, join_table, join_field)
    print "%s of %s shapefiles processed" % (counter, len(shps))
    counter += 1

print "Processing complete."
2

A batch join could do the trick.

I am using ArcGIS 10.5 but I think it will work the same, here is how I would do it:

Open the batch join tool

enter image description here

Then, in the parameters, add all the filed you want receiving a join and simply chose the join fields. Of course, drag the shapefiled you would like to join in the parameter as well.

enter image description here

Afterwards you should be able to leave the computer and the batch process will go at it. This is not mistake proof however, and if joins don't work you might need to restart right? So I'd check on it periodically

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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