1

Is there a way to use:

for dirpath, dirnames, filenames in arcpy.da.Walk():

to filter out annotation feature classes?

The help doesn't specify them as a type, which is strange because using the Feature Class Properties returned by the Describe function, you can filter out annotation.

I'm hoping to walk through a geodatabase and grab everything but the annotation FC's.

  • 2
    Cross-posted from Esri forums – Jason Scheirer Oct 21 '13 at 17:43
  • 1
    Thanks Jason. He provided a very good answer in the cross post. – Mike Oct 23 '13 at 18:26
1

As indicated in a comment by @Mike on his question, there has been code provided by @JasonScheirer at GeoNet that will do this:

def filter_function(walk):  
    for dirname, subdirs, items in walk:  
        new_items = []  
        for item in items:  
            description = arcpy.Describe(os.path.join(dirname, item))  
            if description.dataType == "FeatureClass":  
                if description.featureType != "Annotation":  
                    new_items.append(item)  
            else:  
                new_items.append(item)  
        yield dirname, subdirs, new_items  

for dirpath, dirnames, filenames in filter_function(arcpy.da.Walk(workspace)):  
    # Something interesting goes here  

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.