Batch Merge Shapefile
I had a large number of e00 files which I needed to convert to shapefile and merge together into a single polygon shapefile.
I had ideally wanted to create the process in Model Builder to run the whole process in one go, but couldn't work out how to add the "Import from Interchange File..." tool into Model Builder. Instead I painstakingly added each e00 file to the tool's batch and ran it. This gave me the equivalent coverage files.
I ran into difficulty trying to add all the coverages in one go to a batch "Feature Class to Shapefile" process, so once again painstakingly had to go through and add each file individually. The process would crash for some reason while going through, so I would have to delete all of the successful previously run files from the batch list before continuing it (force-feeding it through). This gave me the equivalent polygon shapefiles.
I would now like to merge all of the shapefiles into a single shapefile. I figured this could probably done in Model Builder as well, but then came across this fairly recent article (http://mappingcenter.esri.com/index.cfm?fa=ask.answers&q=1682) which suggested using python instead. So I made the necessary changes to suit my data, but ran into two errors.
- The first, it did not approve of the = sign found in the code.
- The second, it could not locate a module called arcpy.
I am running ArcGIS 9.3.1 on Windows XP, which came with Python 2.5.1
I'd appreciate your assistance, including any advice you could give me on the previous processes that I had trouble with.
Mapping Center Answer:
First of all, you can use Model Builder or python depending upon your preference. The script I have written is based on the new arcpy module available in ArcGIS 10. In 10, Model Builder also has iterators, which are easy to use for looping through folders -- they have more functionality than in ArcGIS 9.3.1.
As you are still working with 9.3.1, you would need to modify the script that I wrote. Since the arcpy module is new in 10, it won't work in 9.3.1. Refer to the Merge tool help for 9.3.1 and look at the end for a script example. Each tool help has a python script example - you can string different operations into a series in one script and it will work in one go.
You have not mentioned whether your shapefiles are in one folder or if they are in subfolders. If they are in one folder, you would not need a script or model, as you can add multiple shapefiles in the Merge tool.
Finally, I would recommend upgrading to ArcGIS 10 for access to the functionality I mentioned above.
Here are a few resources that will help you get started:
If you would like to post a comment, please login.