What is the full path of a Featureclass?

2752
7
04-22-2010 08:13 AM
JoshV
by
Occasional Contributor
Hello-

I'm needing to get the full path of a featureclass.  So if I have a featureclass called "Wells" and it resides in C:\Temp\WellData.gdb what would be the full path?

Thanks,
0 Kudos
7 Replies
KirkKuykendall
Occasional Contributor III
I'd go with whatever shows up in the Location: box in arccatalog when you have it selected in the treeview, which would be C:\Temp\WellData.gdb\Wells
0 Kudos
JeffMatson
Occasional Contributor III
I'm not sure from where you are needing to access the path (ArcMap, ArcCatalog, etc) but here are a couple of examples:

'ArcMap
Dim pMxDoc As IMxDocument
    Dim pFL As IFeatureLayer
    Dim pDS As IDataset
    Dim pWS As IWorkspace
    Set pMxDoc = ThisDocument
    Set pFL = pMxDoc.SelectedLayer
    Set pDS = pFL.FeatureClass
    Set pWS = pDS.Workspace
    MsgBox pWS.PathName & "\" & pDS.Name

'ArcCatalog
Dim pGxApp As IGxApplication
    Dim pGxObj As IGxObject
    Dim pGxArray As IGxObjectArray
    Set pGxApp = Application
    Set pGxObj = pGxApp.SelectedObject
    Set pGxArray = New GxObjectArray
    pGxArray.Insert -1, pGxObj
    MsgBox pGxArray.Item(0).FullName
0 Kudos
KirkKuykendall
Occasional Contributor III
You should also include the featuredataset's name in the path, if there is one.
0 Kudos
JeffMatson
Occasional Contributor III
You should also include the featuredataset's name in the path, if there is one.


Good point Kirk; I rarely work with featureDataset but I suppose this could be added to the ArcMap example to make it more complete:

    Dim pFD As IFeatureDataset
    Set pFD = pFL.FeatureClass.FeatureDataset
    If pFD Is Nothing Then
        MsgBox pWS.PathName & "\" & pDS.Name
    Else
        MsgBox pWS.PathName & "\" & pFD.Name & "\" & pDS.Name
    End If
0 Kudos
CK
by
New Contributor
Hi,

thanks to your description I got the full path of some feature classes in a feature dataset. I need it to split polygons at each vertex in order to calculate the centroid points of the lines afterwards (using VBA). The tool "split line at vertices" requires an input feature class (the geometry that will be split) and an output feature class (both as path names).
With shapefiles it works without any mistakes. But with feature classes in a feature dataset I get errors. Same problem with other tools that require a path name...
Can anybody help?

Thanks
0 Kudos
JeffMatson
Occasional Contributor III
I'm not sure what would cause that, can you post your code?
0 Kudos
CK
by
New Contributor
I found the mistake on my own. 🙂
0 Kudos