Ask A Cartographer

Batch Merge Shapefile

January 15 2011 | 2 comments
Categories: ArcGIS Methods, Map Data

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.

Thank you.

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:

Model Builder for e00 --> shp posted by Stephanie LaRose on Sep 2 2011 1:37PM
I am trying to do the same thing of batch converting e00 files to shapefile and would also like to use Model Builder if possible. Can you share a model that would do the first two steps that the person did? If so, please email it to be at stlarose@vassar.edu!
re: Model Builder for e00 --> shp posted by Rajinder Nagi on Sep 2 2011 3:29PM
You would need to use Iterators in Model Builder to iterate over all the e00 files in a folder. Then use the Import From Interchange File (Coverage) tool (http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001300000028000000.htm), and then Feature Class To Feature Class (Conversion) tool (http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//001200000020000000.htm) to convert from coverage to shapefile. These tools can all be put together in one model to run.

Model Builder is easy to use -- in case you are not familiar with it, here are the online help topics which would be useful:


1) What is ModelBuilder?

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/What_is_ModelBuilder/002w00000001000000/

2) Tutorial: Creating tools with ModelBuilder

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Tutorial_Creating_tools_with_ModelBuilder/002w0000007v000000/

3) An overview of the Iterator toolset

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/An_overview_of_the_Iterator_toolset/00400000000n000000/

4) A quick tour of using iterators for iteration — (Looping)
http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//002w0000001w000000.htm

Hope this helps!

If you would like to post a comment, please login.

Contact Us | Legal | Privacy |