Select to view content in your preferred language

Getting FEATURE DATASET name - not FEATURE CLASS name - using Python

3422
11
09-10-2013 08:39 AM
LorindaGilbert
Frequent Contributor
So,
Has anyone figured out how to get the Feature Dataset name using Python when your data is residing in FeatureDatasets within the database?  I see that the layer.datasetName is really the feature class name.  Unfortunately, we have several feature classes within feature datasets for network and topology purposes and now that we are changing servers, I need to have a script that will change the source data. 

Alas, as of right now, I can't do it via script unless someone has a work around out there. 

I've been banging my head against the wall for a week now, because like some others, when a term 'dataset' is used, you would expect it to be related to the same things that it is elsewhere.  I'd seriously consider an attempt to parse the name out, but we have several different former datasources referenced (even after changing them in the mxd - thanks for hardcoding ESRI) and the feature dataset names are many different lengths.

Thanks if anyone has a workaround to help with this.
Tags (2)
0 Kudos
11 Replies
RDHarles
Regular Contributor
Thank you for the excellent clarification rdharles

3.) We also have a path set to where the the python installlation is

Do you have this set with the PYTHONPATH environmental variable?


I don't have the PYTHONPATH set.  I have the following in the same PATH variable:
C:\Python27\ArcGIS10.1

...but, perhaps you can set it there as well and it will work, not sure.  I'm just in the habit of putting everything in the PATH variable.
0 Kudos
NeilAyres
MVP Alum
This thread seems to be going off track.....

Have you had a look at : http://resources.arcgis.com/en/help/main/10.1/#/Walk/018w00000023000000/
And use arcpy.Describe functionality as detailed above.

When I want to point to a specific location to run a script I normally just set a variable like
import arcpy, os
from arcpy import env
HomeDir = "c:/Data/Path to dataset.."
db = "MyData.gdb"
InputData = os.path.join(HomeDir, db)
env.workspace = InputData


Cheers,
N
0 Kudos