I have polygon, line and point shapefiles in a folder and I am trying merge shapefiles based the shape like polygon, line and points.
I have searched and I got the code but it merges only if input files are same type.
My requirement is to merge all files based on the geometry. It means it merge all polygons and after that merge line files and point files.
How can I modify the code below?
import arcpy
import os
arcpy.env.workspace = r"C:\Shapefiles"
fcs_in = arcpy.ListFeatureClasses()
fn_source_field = 'SOURCE_SHP'
for fc in fcs_in:
print 'fc:', fc
name = os.path.splitext(fc)[0]
arcpy.AddField_management(fc, fn_source_field, 'TEXT')
with arcpy.da.UpdateCursor(fc, fn_source_field) as cur:
for row in cur:
row[0] = name
cur.updateRow(row)
fc_output = r"C:\Shapefiles\Merge_poly.shp"
arcpy.Merge_management(fcs_in, fc_output)