I have been trying for more then 4 hours but i am cinfused how i should get all layer names from gdb files. I am using latest file goedatabase API but there is no help that i can found to get all layernames in gdb. Then i have to read further each layer items.
Any help will be highly appreciated. I am attaching my gdb file
Solved! Go to Solution.
The file geodatabase data model only has two levels:
You cannot place a feature dataset (or any other container) within a feature dataset (or any other container). This is why I test with OpenTable (which has the side effect of letting you access the field information).
- V
sir now we have feature classes. now how to read metadata(RGN and DES file) of each of feature classes?
I'm sorry, but I have no idea what an RGN or DES file might be.
The only place metadata is stored "in" a feature class is in the XML document which defines the feature class, which is exposed by Geodatabase::GetDatasetDocumentation(). Once you have the XML you can parse it with whatever tool you like.
In the future, please start a new thread to ask a new question.
- V
Hello Vince,
I had the same question as muneem: How to find the top level contents in a FGDB. I just had a look at your sample code, but I fail to understand it. I am working in C#. According to the C# documentation that came with the API the "GetChildDatasets" method takes only two parameters, yet in your example you supply this function with 3 parameters.
Is there a difference between the C++ and the C# API here? What would be the C# alternative to get the top level content?
Thanks in advance!
Ward Segers.
C# is a wrapper around C++. All functions return status in C++, but that is covered by exceptions in C#, so the third parameter of GetChildDatasets in C++ (which is the returned object pointer, by reference) is just the returned value in C#. If you pull up the documentation for both C++ and C# side by side, the equivalents should be intuitive.
In C#, the top level would be extracted exactly the same, using Geodatabase.GetChildDatasets with a parentPath of "\" and a dataSetType of ""("Feature Class" for only feature classes).
- V
Hey Vince,
Now that you explained it all makes perfect sense :-).
Just wanted to point out that in C# the parent path should be expressed as "\\" instead of "\"
Thanks!
Ward Segers.
Yes, in languages where backslashes are escaped (C/C++/Java/C#/Python*), the string "\" will be represented "\\". As noted in my answer, the command-line is not one of those places, so if the parameter is being passed from the command-line, the string "\" must be used ("\\" attempts to find the empty-string named child of the empty-string dataset [which can't exist, so no rows are returned]).
- V
* Except when a literal flag is used on the string, e.g., "path = r'\' "