I am trying to get the database path of a feature class that may or may not be in a feature dataset. I am using the os.path.dirname
of the feature class. This will give me either the database path if the feature class is not in a feature dataset (great), but if the feature class is in a feature dataset, it will give me the path to the feature dataset.
This could be a file, personal or sde geodatabase. I was thinking of a split
using the '.sde' but that won't work if it is a different type of geodatabase.
A sample of the path could be:
- For inside a feature dataset: C:\GISData\Data.gdb\Property\Erf
- For under the gdb root: C:\GISData\Data.gdb\Erf
In both these cases I would like to get C:\GISData\Data.gdb.
Thank you.
try
andexcept
checking theworkspaceType
ordatasetType == "FeatureDataset"
, but this is definitely a cleaner way to do it. – Claire