1

I have to Clip the data in a file Geodatabase in which there are about 80 Feature Datasets which includes about 20 feature classes in each one of the Feature Datasets.

I have created the model once which iteration of "Feature Classes", once with "Datasets" and once with " Workspace".

I was able to do some clipping but None of them do it through the whole GDB and just get the first Feature dataset. How can I make it automatically for the whole FGDB?

  • Should all feature classes be clipped with the same clip features? Where do you want to store all outputs? – BERA Nov 9 '18 at 14:18
  • That is true. All the Features are supposed to Clip . It is possible to save them even in a new FGDB. – Chiki2025 Nov 12 '18 at 9:11
2

This is easier with arcpy. If you dont want an arcpy solution I can delete my answer.

Script will list all feature datasets in database, and for each list all feature classes and then clip with specified clip feature. Outputs will be placed in the same feature dataset and with '_clipped' appended to name.

Make sure you have no feature datasets or feature classes in the database but the ones you want clipped.

import arcpy, os
arcpy.env.addOutputsToMap = False #Remove this line if you want all outputs to be added to the map
database = r'C:\Somedatabase.gdb' #Change
clip_feature = r'C:\Somedatabase.gdb\eraser' #Change

arcpy.env.workspace = database
datasets = arcpy.ListDatasets(feature_type='Feature')

for dataset in datasets:
    arcpy.env.workspace = os.path.join(database,dataset)
    features = arcpy.ListFeatureClasses()
    for feature in features:
        arcpy.Clip_analysis(in_features=feature, clip_features=clip_feature, 
                           out_feature_class=feature+'_clipped')

enter image description here

  • 1
    Thank you very much for your Feedback. I am not really pro in ArcPy but I am going to try it. – Chiki2025 Nov 12 '18 at 9:10
  • I tried the Code but I receive error – Chiki2025 Nov 12 '18 at 9:33
  • @Chiki2025 what is the error message? – BERA Nov 12 '18 at 9:46
  • this is the error: Runtime error Traceback (most recent call last): File "<string>", line 4, in <module> TypeError: 'NoneType' object is not iterable – Chiki2025 Nov 12 '18 at 10:02
  • It works strange. I have limited the featuredatasets to just two and it works. However, when I increase the number of the featuredatasets, it stocks and I get Errors. – Chiki2025 Nov 12 '18 at 10:40

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.