I have over 1000 file geodatabases (fgdb), each fgdb contains ONE feature class (polygons) and covers different areas of the country

The aim is to merge/append all feature class from fgdb into a feature class.

So far I've tried Merge multiple geodatabases into one but couldn't work. The Append Multiple Geodatabase script tool in ArcGIS gave me an empty output... Plus the toolbox can only merge 5 gdb a time.

enter image description here

  • Merging a dozen or score at a time seems like a much less risky task than doing anything a thousand at a time. And if you have multiple independent disks, you might see some benefit of parallelism. If the net result is tens of millions of features in one table, then you probably want to step up to a proper database, like PostgreSQL. – Vince Feb 25 at 3:57
  • @BERA yes, the number and name of the fields are the same – LynnLatitude Mar 1 at 12:57

This approach uses the Walk function in the arcpy site package to recursively find and gather feature classes from a directory. Once a list of feature classes is generated, it merges the featureclasses.

import arcpy
import os

# Define the workspace where all the file geodatabases are located
workspace = r'C:\temp'

# Define the path of the output merged feature class
merged_fc = r'C:\path\to\some\file_geodatabase.gdb\merged'

# Create an empty list to populate with feature classes
fcs = []

# Walk through the directory topdown and search for all featureclasses
walk = arcpy.da.Walk(workspace, topdown=True, datatype="FeatureClass")
for dirpath, dirnames, filenames in walk:
    for filename in filenames:
        # Append the feature class to the fcs list
        fcs.append(os.path.join(dirpath, filename))

# Merge the list of feature classes
arcpy.Merge_management(fcs, merged_fc)

Judging by your use of ArcCatalog, the easiest route for you might be to use an iterator in ModelBuilder. The Feature Classes iterator can loop through the geodatabases and append the feature classes to a target dataset.

Check the 'Recursive (optional)' box in the iterator if there are nested folders.

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.