I have lots of polygons from different projects and I am trying to merge them together to form 1 large shapefile so I can display the places where we have done projects at. What I want to be able to do is get the pathway of each shapefile to appear in the attribute table. Otherwise, it would also be helpful if I can rename each shapefile so when I merge them the new name appears with the path name.
How can I do this in ArcMap 10.6?
I have very basic experience with python coding.
Why not make a File Geodatabase and bring the shapefiles inside.
It will save the ugly mess of trying to maintain field names during the merge process.
You can always provide documentation in the geodatabase as to the original sources as well
That would be helpful. However, I need to display the source of the shapefile to know specific details of each project, e.g. project name, project number, name of the site, location, etc. All of it is contained within the path name.
Can this be done when putting it into a gdb?
I'm sure the project name, number, name of the site and location can be relevant to the data and the subsequent processed you will want to apply to the data afterwards. My advise is to create separate fields that will hold that info and fill those with the info in the path. You don't want that data to be "hidden" inside a path stored in a text field.
Can you provide an example path with an explanation of what should be extracted from the path?
That would be worse... imagine 100 files of 1000 records all with an ugly path repeated in a field or as a name... meta data documentation in a gdb would be best
Let me give you some extra background info;
We are trying to set up a database that we can show where all of our previous projects have been. To do this we are going to use the "Site Boundary" shapefile from each project. the problem that we have is that most of the Site boundary shapefiles are named the same and have no real information in the attribute table. If we merge all the files at this point, they will show us where a project was, but not what it was. To do this we need the client name and project number as a minimum. As it stands, this information is already included in the file path of the original shapefile. If we can include the file path as an attribute we will then be able to reference the project that each shapefile was from.
Is there a way that you can bring all of the previous shapefiles into a gdb while automatically including the file path as either metadata or as an attribute?
If I were you, I would
1. Create a polygon Feature Class in the database if there is an enterprise database, or create a Feature Class in a File Geodatabase.
2. The data structure of the Feature Class depends on the information you want to store: project number, client name, etc.
3. Iterate the all the folders where the shapefiles are placed, and analyze the full path for each shapefile and get the list of project information from the parts of the path (should be very easy to do if the information is stored in the folder names). The os module and relevant functions are handy for this task
4. Using arcpy Data Access module to get the geometry in the shapefiles. and create a list to store the geometry and related project information.
5. Iterate the items (tuple) in the list, and insert the tuple into the Feature Class using arcpy Data Access module
Hope this provides some clue to the final solution.
The point here is, don't store the file path in the database, extract the information instead. this will help you a long way in the future analysis and system integration.
Your are spot on, but that's not what I'm suggesting. Ditch the path name idea all together and put that information into individual attributes of each polygon feature class (that are all set up exactly the same way...)
I am not sure I understand the problem.
All you need to do is to add to each shape an attribute named "FilePath" (and any other project information like StartDate etc.) and calc it to the correct value.
Then Append all shape file into one big shape just adding the basic attributes that each shapefile has (like the FilePath) and ignore any shape specific attributes.
You will have one big polygon shapefile that each polygon have the project information and path.