0

I have 10 geodatabases, each one has 20 feature class on average, and every one feature class has the same name. What I want is a merge from every single feature class with the same name into another geodatabase.

I made a script where first all list all the feature class from the geodatabase, but I am stuck I don't know how to realize the merge from every several geodatabases into one geodatabase.

#-*- coding:utf-8 -*-
import arcpy
from arcpy import env

arcpy.env.workspace = r'C\...\GDBESTATALES_PRUEBA' #This is my folder where I have all my geodatabases

OutputMerge = r'C\...\Resultado\GDB_Nacional\GDB_Nacional.gdb'#This is the gdb where I want to save all the merges

List_workspaces = arcpy.ListWorkspaces()
List_featureclass = arcpy.ListFeatureClasses()

for ws in List_workspaces:
    print ws
    env.workspace = ws
    fcs = arcpy.ListFeatureClasses()
    for fc in fcs:
        print fc
    #I don't know what to do after this point

How do I merge the feature class from several geodatabases into another geodatabase?

1

First you have to create the output Feature Class and you can do it using an existing Feature Class as template:

out_fc = arcpy.CreateFeatureclass_management(out_path = 'output_ws_path', out_name = 'fcs_merge', template = fc)

Then you can use Append to load all the features from each fc within the for loop:

arcpy.Append_management(fc, out_fc, 'NO_TEST')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.