Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 :)

share|improve this question
    
Have you tried "**P**oint" instead of "**p**oint". Case often matters. –  RyanDalton Jun 4 '13 at 17:29
    
Yep, tried both, same result. –  Vidar Jun 5 '13 at 10:34

2 Answers 2

up vote 1 down vote accepted

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
share|improve this answer
    
Comments are great. –  ian Mar 26 at 19:08

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")
share|improve this answer
    
Doesn't work, tried with just an "*" and "Point", it still brings back all point featureclasses and all grids. –  Vidar Jun 4 '13 at 14:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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