0

I have path to layer or feature

C:\base.gdb\test

How to check is table or feature class by arcpy?

4

You may use Describe Object property dataType:

desc = arcpy.Describe("C:/base.gdb/test")
if desc.dataType == 'FeatureClass':
    print 'fc'
elif desc.dataType == 'Table':
    print 'table'
else: print desc.dataType
0

Use the arcpy.List... functions. First have to set the env.workspace to the fgdb. Then use arcpy.ListTables() or arcpy.ListFeatureclasses(). Each of these returns a python list of the requested type. If the list is empty (len(list) == 0), then there is no thing of that type. Unfortunately there does not seem to be a higher level function like arcpy.ListContents() or something.

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.