import arcpy arcpy.env.workspace = "yourdegeodatabase.sde" fcDict = {} #loop through and fill dictionary dsList = arcpy.ListDatasets() for ds in dsList: fcList = arcpy.ListFeatureClasses("*","",ds) for fc in fcList: fcDict[fc] = ds #test myFC = arcpy.Describe("thefciwanttotest") if myFC.name in fcDict: print fcDict[myFC.name]
import arcpy arcpy.env.workspace = "yourdegeodatabase.sde" myFC = arcpy.Describe("thefciwanttotest") #loop through dsList = arcpy.ListDatasets() for ds in dsList: fcList = arcpy.ListFeatureClasses(myFC.name,"",ds) for fc in fcList: print ds
Is there a way in ArcPy to test a featureclass in order to see if it is part of a featuredataset + get the name of the featuredataset?Thanks!
import arcpy, os def GetFDS(FC): """ Returns the feature dataset for a feature class or feature layer FC. If the feature class is not within a feature dataset, returns None.""" # get the path to the feature class fcPath = arcpy.describe(FC).catalogPath # get the path to its container fcHome = os.path.dirname(fcPath) # is it a feature dataset?? if arcpy.describe(fcHome).dataType == "FeatureDataset": return fcHome else: return None
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.