I have over 60 shapefiles, all in their own folders. I'm looking to add a field titled "Name" and then populate it with the name of the shapefile. I want to be able to do this so that I can then merge the files together while retaining a unique identifier for each. I can do this by hand of course, but would like to script it. I don't know Python and I'm familiar though not very experienced with ModelBuilder. I'm using ArcGIS 10. Thanks!
|
This will do it
|
|||||
|
|
For python the pieces needed are: os.path.walk to recurse through the directories, arcpy.ListFeatureClasses in each to generate lists of shapes to operate on, from there you can use the add field tool to add and populate a 'Name' field. I'll let someone else address a modeller or toolbox approach, with one parting shot: most people don't realise all the tools have a batch mode. Right click on the tool, select batch, then drag'n'drop inputs from Arccatalog. Sometimes a lot faster for the human than building a model or script. |
|||
|
|
|
GeoWizards is faster than the ArcGIS Append tool http://www.ian-ko.com/ET_GeoWizards/UserGuide/mergeLayers.htm (preserves file name locations) If purchased you will have access to the tools and the scripts to execute the function you want. (the free version does not allow this scripting function) |
|||
|
|
