I am looking at this link where we can get all featureclasses, tables or featuredatasets from a geodatabase. I would like to do the same with a File system datastore. Task is to delete all empty feature classes saved in file system datastore.
Currently I have code that loops through all the files in the directory with shape file extensions and use open dataset to check the count and then delete the files.
Is there a way to Obtain List of Defintions from File system datastore ?
Solved! Go to Solution.
Uma's solution will work for file geodatabases. For shape files, we don't yet provide this functionality. I've added it to our backlog for a future release. In the meantime, your existing algorithm of looping through files in the directory with the .shp extension is your best bet.
--Rich
Can you try getting the definitions of feature classes using the FileGeodatabase? Will that work for you?
Like this:
public async Task ObtainingDefinitionsFromGeodatabase(){
await ArcGIS.Desktop.Framework.Threading.Tasks.QueuedTask.Run(() => {
using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\Data\Admin\AdminData.gdb")))){
IReadOnlyList<FeatureClassDefinition> fileGDBDefinitions = geodatabase.GetDefinitions<FeatureClassDefinition>();
IReadOnlyList<FeatureDatasetDefinition> featureDatasetDefinitions = geodatabase.GetDefinitions<FeatureDatasetDefinition>();
IReadOnlyList<FeatureClassDefinition> featureClassDefinitions = geodatabase.GetDefinitions<FeatureClassDefinition>();
}
});
}
Uma's solution will work for file geodatabases. For shape files, we don't yet provide this functionality. I've added it to our backlog for a future release. In the meantime, your existing algorithm of looping through files in the directory with the .shp extension is your best bet.
--Rich
Uma Harano Thanks Uma. I have pretty much same code for Geodatabase and I was looking for retrieving shapefile from a folder. Thanks Rich Ruh for confirming that and considering it future releases.