Any help with Arcpy Merge Management?

2538
4
Jump to solution
11-14-2019 06:42 AM
TravisMcClain
New Contributor

Hello I am currently trying to automate some processes in arcmap with python and running into an issue with the Merge_Management Function. When I ran the tool through arcmap it merged the four seperate shapefiles together and was able to move to the next step and when I ran the code to test to make sure the merged worked I checked the output folder and it created it like I needed it too. Just when I add the next step to the code it gives me the Error 000732 stating that the merge layer doesn't exist or is not supported. I have ran the process in a new script and set the varible to that path for the shapefile and it works just not in the larger code moving to the next step. I would like the merge to work it would cut down on some lines of code. Any help would be appericated. 

Below is the snippet of code the stuff before works without issues:

#This will intersect the gaps shapefile with the members shapefile to see if any members fall in the gaps produced
print("Intersecting Gap Layer with Members Layer")
#This is the Intersection of Large Metro County Gaps with Member Data
large_metro_members_intersect = arcpy.Intersect_analysis([large_metro_erase_analysis,member],"large_members_intersect","ALL","","")
#This is the Intersection of Metro County Gaps with Member Data
metro_members_intersect = arcpy.Intersect_analysis([metro_erase_analysis,member],"metro_members_intersect","ALL","","")
#This is the Itersection of Micro County Gaps with Member Data
micro_members_intersect = arcpy.Intersect_analysis([micro_erase_analysis,member],"micro_members_intersect","ALL","","")
#This is the Intersection of Rural County Gaps with Member Data
rural_members_intersect = arcpy.Intersect_analysis([rural_erase_analysis,member],"rural_members_intersect","ALL","","")
#This merges all the member data together
merged_member_data = arcpy.Merge_management([large_metro_members_intersect,metro_members_intersect,micro_members_intersect,rural_members_intersect],"merged_member_data")
#Performing Summary Statistics to gather total number of members for each gap
print("Producing Summary Table for Total Members in Gap Locations")
summary_table_members=arcpy.Statistics_analysis(merged_member_data, "merged_member_data_Statistic", statistics_fields="Count1 SUM", case_field="NAME")

Here is the results page:

Make XY event layer
Feature Layer to Shapefile
CheckedOut
Running Process
Done with Service Area Generation
Starting Erase Analysis Process
Intersecting Gap Layer with Members Layer
Producing Summary Table for Total Members in Gap Locations
Executing: Statistics C:\\Users\\34289980\\Desktop\\local_test\\Buckeye\merged_member_data C:\\Users\\34289980\\Desktop\\local_test\\Buckeye\merged_member_data_Statistic "Count1 SUM" NAME
Start Time: Thu Nov 14 09:28:52 2019
Failed to execute. Parameters are not valid.
ERROR 000732: Input Table: Dataset C:\\Users\\34289980\\Desktop\\local_test\\Buckeye\merged_member_data does not exist or is not supported
Failed to execute (Statistics).
Failed at Thu Nov 14 09:28:52 2019 (Elapsed Time: 0.00 seconds)
6.0 minutes
>>>

Also attached is the arccatalog screen that shows that the merge shapefile is created and is in the output folder along with the other shapefiles created from the script. 

Again any help would be amazing to help me understand why the next step isn't reading the merge layer. Thank you#

0 Kudos
1 Solution

Accepted Solutions
JakeSkinner
Esri Esteemed Contributor

Hi Travis,

I would try the following:

merged_member_data = r"C:\Buckeye\merged_member_data.shp"

arcpy.Merge_management([large_metro_members_intersect,metro_members_intersect,micro_members_intersect,rural_members_intersect],merged_member_data)


#Performing Summary Statistics to gather total number of members for each gap
print("Producing Summary Table for Total Members in Gap Locations")
summary_table_members=arcpy.Statistics_analysis(merged_member_data, "merged_member_data_Statistic", statistics_fields="Count1 SUM", case_field="NAME")

View solution in original post

4 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Travis,

I would try the following:

merged_member_data = r"C:\Buckeye\merged_member_data.shp"

arcpy.Merge_management([large_metro_members_intersect,metro_members_intersect,micro_members_intersect,rural_members_intersect],merged_member_data)


#Performing Summary Statistics to gather total number of members for each gap
print("Producing Summary Table for Total Members in Gap Locations")
summary_table_members=arcpy.Statistics_analysis(merged_member_data, "merged_member_data_Statistic", statistics_fields="Count1 SUM", case_field="NAME")
TravisMcClain
New Contributor

Thank you this worked!

0 Kudos
DanPatterson_Retired
MVP Emeritus

Summary Statistics—Help | ArcGIS Desktop 

The input can be an INFO table, a dBASE table, an OLE DB table, a VPF table, or a feature class.

your script produces

Dataset C:\\Users\\34289980\\Desktop\\local_test\\Buckeye\merged_member_data

If it isn't a featureclass, you might want to generate a dbase table by ensuring the output file name is appended with *.dbf 

/blogs/dan_patterson/2016/08/14/script-formatting 

would help us provide line numbers and readability

TravisMcClain
New Contributor

Thanks for the support will keep this in mind moving forward with any post!

0 Kudos