Display subtypes of a feature class

Here’s a useful snippet I had the chance to use recently. I can’t remember why, but I know it did make my life easier, as Python tends to do.

import arcpy
ftr = r"C://Some//Arb//Folder//work.gdb//ftr"
subs = arcpy.da.ListSubtypes(ftr)
for k, v in subs.iteritems():
print k, v['Name']

view raw
listSubtypesOfFC.py
hosted with ❤ by GitHub

ListSubtypes returns a dictionary of the properties of that subtype. In this instance, I’ve used the Name key to print out the associated name for a particular subtype.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.