Select to view content in your preferred language

Feature Dataset - Workspace or not Workspace?

952
2
08-13-2023 06:57 AM
Labels (2)
SzymAdamowski
Occasional Contributor

At some stage using different ArcGIS PRO tools and python functions I got confused: is Feature Dataset also a Workspace or not? I think now, after some reading I'm closer to understanding its dual nature (you see, not only light), but I'd appreciate further comments, corrections or maybe there's somewhere already definitive explanation of an issue that I've missed.

Let's start with definition of the workspace (source: https://support.esri.com/en-us/gis-dictionary/workspace)

SzymAdamowski_0-1691932594277.png

So clearly there are 2 definitions, not exactly fully overlapping. And to my understanding, Feature Dataset is workspace according to the definition [1] (stated explicitly), and is not workspace according to the definition [2]. Now let's move to practical consequences. Below is the structure of test geodatabase:

SzymAdamowski_1-1691932849764.png

It contains Geodatabase, which has 1 Feature Dataset (FD1), one feature class in FD1 (FeatInFD1) and one feature class directly in Geodatabase (FeatOutside). Let's apply some python tools.

 

 

arcpy.env.workspace=r'E:\GIS_DATA\ArcGIS\WIW\WIW.gdb' #obviously works, Geodatabase is a workspace according to both definitions
arcpy.ListWorkspaces() #FD1 feature dataset not listed, it is not Workspace in this meaning

 

 

So apparently arcpy.ListWorkspaces uses [2] definition. Feature dataset is not returned,so it is not Workspace.

And now something else:

 

 

arcpy.env.workspace=r'E:\GIS_DATA\ArcGIS\WIW\WIW.gdb\FD1' #hey, this time feature dataset is workspace!
arcpy.ListFeatureClasses() #it will return ['FeatInFD1']

 

 

For arcpy.env.workspace feature dataset is Workspace in meaning of definition [1] - it can be set and used with arcpy.ListWhatever set of functions. Confusing? Well for me it was (and still is).

It looks like feature dataset is mostly treated in line with definition [2]. More examples:

- arcpy.Describe Workspace Properties will not work with feature dataset

- script tool will not accept feature dataset if script parameter Data Type is set to Workspace

On the other hand help of arcpy.Walk function states that: (https://pro.arcgis.com/en/pro-app/latest/arcpy/data-access/walk.htm)

 

  • dirnames is a list of names of subdirectories and other workspaces in dirpath.
  • filenames is a list of names of nonworkspace contents in dirpath.

and yes, feature dataset is returned in dirnames rather than filenames (so it is workspace this time). On the same side there is this error (https://pro.arcgis.com/en/pro-app/latest/tool-reference/tool-errors-and-warnings/001001-010000/tool-...😞

SzymAdamowski_3-1691934644613.png

 

It is only a bit of comfort to me that even Esri employees seemed to be confused sometimes (source: https://community.esri.com/t5/geoprocessing-questions/feature-dataset-as-environment-workspace/m-p/4...😞

SzymAdamowski_2-1691934055168.png

I know it might be too late to change conventions, functions names or attributes but it would be great to put some clear explanations somewhere in the help. Also I have a feeling that dual definition of Workspace could also affect other structures like toolboxes and raster dataset - these ones not tested though.

 

2 Replies
DanPatterson
MVP Esteemed Contributor

NIM089681 from 2013 Will Not Be Addressed

resolution will not be addressed


... sort of retired...
0 Kudos
SzymAdamowski
Occasional Contributor

Of course it won't be. It didn't make sense in the first place. I just used it as the example of how people are confused by Feature Dataset capabilities of sometimes being Workspace and sometimes not.