0

Why, when I issue the function:

fcList = arcpy.ListFeatureClasses(feature_type='point')

does it bring back a list of grid/rasters as well as all my point featureclasses from ArcSDE. All I want is my point featureclasses, this doesn't make any sense! Anyone had this happen to them? Plus it is incredibly slow!

Any help much appreciated :)

2
  • Have you tried "Point" instead of "point". Case often matters. Commented Jun 4, 2013 at 17:29
  • Yep, tried both, same result.
    – Vidar
    Commented Jun 5, 2013 at 10:34

2 Answers 2

4

You can emulate the example in the ArcMap Help The code example from there does not have an = sign, just a wildcard and a feature type, as referenced there...

# Set the workspace. List all of the polygon feature classes that 
#   start with 'G'
#
arcpy.env.workspace = "D:/St_Johns/data.gdb"

fcs = arcpy.ListFeatureClasses("G*", "polygon")
1
  • Doesn't work, tried with just an "*" and "Point", it still brings back all point featureclasses and all grids.
    – Vidar
    Commented Jun 4, 2013 at 14:49
1

Sorry to reply so late. This is a bug. The workaround below satisfied my needs (10.1). Others (esri link) suggested using a Describe, but I found that too slow and unnecessary.

#Main call:  
for FC in bugListFeatureClasses("filter","feature type","feature dataset"):
    #do something

def bugListFeatureClasses(wildCard, fType, FD): 
    """
    Uses current workspace
    This is required because a 4 YEAR OLD BUG in arcpy still exists.
        arcpy.ListFeatureClasses() returns rasters
        Arc10 + SQL Server = apparently too complicated for Esri
        http://support.esri.com/en/bugs/nimbus/TklNMDYyMDc0 (must sign in first)
    """
    badFCList = arcpy.ListFeatureClasses(wildCard,fType,FD)
    rasList = [x.lower() for x in arcpy.ListRasters()]
    goodFCList = []
    for FC in badFCList:
        if FC.lower() not in rasList:
            goodFCList.append(FC)

    return goodFCList
1
  • Comments are great.
    – ianbroad
    Commented Mar 26, 2014 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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