Select to view content in your preferred language

Obtain List of Defintions from File system datastore

645
3
Jump to solution
05-30-2020 02:31 PM
Vamsi_KrishnaYarramaasu
Emerging Contributor

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 ?

0 Kudos
1 Solution

Accepted Solutions
RichRuh
Esri Regular Contributor

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

View solution in original post

0 Kudos
3 Replies
UmaHarano
Esri Regular Contributor

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>();

     }
   });
}‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
RichRuh
Esri Regular Contributor

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

0 Kudos
Vamsi_KrishnaYarramaasu
Emerging Contributor

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.

0 Kudos