# List all features classes in a particular dataset

**URL:** <https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255>\
**Category:** MapWinGIS\
**Created:** [February 19, 2022, 8:25am UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255 "2022-02-19T08:25:54Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![alrajhi20](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alrajhi20](https://mapwindow.discourse.group/u/alrajhi20)\
**Post date:** [February 19, 2022, 8:25am UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/1 "2022-02-19T08:25:54Z")

</div>

I could successfully loop through all feature classes in ESRI-geodatabase features. But, some of these features resides inside dataset. How can I list all feature classes in one particular dataset.  
Thanks

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [February 20, 2022, 7:25pm UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/2 "2022-02-20T19:25:16Z")

</div>

Hello @alrajhi20

I’m not sure I fully understand your question. It might help to provide a little sample code, showing how you are trying to read the Feature Classses and Datasets.

As you may know, MapWinGIS uses the GDAL library for all non-Shapefile datasources. So it might also help to review the GDAL documentation regarding the [ESRI GDB Driver](https://gdal.org/drivers/vector/openfilegdb.html).

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![alrajhi20](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alrajhi20](https://mapwindow.discourse.group/u/alrajhi20)\
**Post date:** [February 21, 2022, 9:10pm UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/3 "2022-02-21T21:10:59Z")

</div>

Hi Mr. Jerry,  
I have a esri-geodatabase that has multiple datasets. All other feature classes are classified inside these datasets. See picture:  
 ![ds](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/83d2562e3e10fbead40aa1e7d7e1ffb63f5e322a.png)  
Now for example, I just want to list all feature class in AeronauticalInformation dataset only. I am not interested in other datasets.  
Well, your statement: “As you may know, MapWinGIS uses the GDAL library for all non-Shapefile datasources” is very helpful, so I will look at GDAL library to find out how.  
Thanks

---

<div class="post-metadata">

**Author:** ![alrajhi20](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alrajhi20](https://mapwindow.discourse.group/u/alrajhi20)\
**Post date:** [February 25, 2022, 10:46am UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/4 "2022-02-25T10:46:05Z")

</div>

Hi Mr. Jerry,  
I really could not find a clean and understandable code of GDAL library for my problem.  
Would you please guide me with code or with link.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [February 26, 2022, 11:54pm UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/5 "2022-02-26T23:54:18Z")

</div>

Are you able/allowed to upload the AeronauticalInformation dataset? I don’t know what the GDB looks like through through the API, but I could have a look and try some things.

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![alrajhi20](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alrajhi20](https://mapwindow.discourse.group/u/alrajhi20)\
**Post date:** [February 28, 2022, 3:39pm UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/6 "2022-02-28T15:39:20Z")

</div>

I don’t know what do you mean with “upload the AeronauticalInformation dataset”. but I have this gdb in my C# winforms application.  
I would appreciate it if you could have a look to my sample esri geodatabase attached. Try to for example to list feature classes in Metadata dataset.  
[sample.zip](https://mapwindow.discourse.group/uploads/short-url/jOfX8IQcGZTmoEsuj8FGi2lU6vT.zip) (2.1 MB)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [March 1, 2022, 5:23am UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/7 "2022-03-01T05:23:42Z")

</div>

Hello @alrajhi20

I don’t see a Metadata dataset. What I see are 5 layers, being  
index\_100k, index\_50k, Road, BuildUpArea, and Enclosure.

And each of the layers have a number of Features, as displayed below (zoomed in to the significant area).

Here is the code I used:

```
Dim ds As New OgrDatasource()
Dim cs As String = "c:\temp\sample\data.gdb"
If ds.Open(cs) Then
    Dim layers As Integer = ds.LayerCount
    For i = layers - 1 To 0 Step -1
        Dim layerName As String = ds.GetLayerName(i)
        Debug.WriteLine(layerName)
        Dim ogr As OgrLayer = ds.GetLayer(i)
        AxMap1.AddLayer(ogr, True)
    Next
    AxMap1.ZoomToMaxVisibleExtents()
End If

```

Is this not what you expected?

![image](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/c82c3cda88433d537e6defb1832f5f75a4709a77.png)

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![alrajhi20](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alrajhi20](https://mapwindow.discourse.group/u/alrajhi20)\
**Post date:** [March 3, 2022, 4:09am UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/8 "2022-03-03T04:09:41Z")

</div>

Hi Mr. Jerry,  
Thanks for your reply.  
I already could load these features in my map. My real problem is that for some reason I need to display only indexes index\_100k and index\_50k in my map. I somehow want to get the dataset name for each feature class in my OgrDatasource.  
Thanks

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [March 3, 2022, 4:48am UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/9 "2022-03-03T04:48:12Z")

</div>

Ok. Did you see in my sample code that you can get the name on each iteration, and then only load the ones you want. Something like:

```
Dim ds As New OgrDatasource()
Dim cs As String = "c:\temp\sample\data.gdb"
If ds.Open(cs) Then
    Dim layers As Integer = ds.LayerCount
    For i = layers - 1 To 0 Step -1
        Dim layerName As String = ds.GetLayerName(i)
        Debug.WriteLine(layerName)
        If layerName.Substring(0, 5) = "index" Then
            Dim ogr As OgrLayer = ds.GetLayer(i)
            AxMap1.AddLayer(ogr, True)
        End If
    Next
    AxMap1.ZoomToMaxVisibleExtents()
End If

```

I don’t know if you’re using VB or c#, but the syntax is similar.

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![alrajhi20](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alrajhi20](https://mapwindow.discourse.group/u/alrajhi20)\
**Post date:** [March 4, 2022, 6:37am UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/10 "2022-03-04T06:37:27Z")

</div>

Well, this code will solve a particular case when feature class name starts with “index”, but code doesn’t yet solve the problem.  
I am using C#

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [March 5, 2022, 5:05pm UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/11 "2022-03-05T17:05:42Z")

</div>

> [@alrajhi20](#):
>
> My real problem is that for some reason I need to display only indexes index\_100k and index\_50k in my map.

I’m sorry, but this is what I understood you to be saying was the problem. So I guess I don’t understand what you are asking.

---

<div class="post-metadata">

**Author:** ![alrajhi20](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@alrajhi20](https://mapwindow.discourse.group/u/alrajhi20)\
**Post date:** [March 5, 2022, 6:20pm UTC](https://mapwindow.discourse.group/t/list-all-features-classes-in-a-particular-dataset/1255/12 "2022-03-05T18:20:42Z")

</div>

Sorry, maybe the way I had written the question does not clearly say it.  
To be more clear:  
I want the application to enable user to select file geo-database. then application will list all datasets in selected geo-database. Then when user select a particular dataset from drop down list for example, application will list all feature classes within selected dataset.  
This is main goal.
