Skip to main content
Solved

Extract Feature Class Names to Excel


vxn43
Supporter
Forum|alt.badge.img+18

I need to make an inventory of the GIS data my organization has. As a first step, I need to make a list of the names of the Feature Classes in each of our File Geodatabases.

 

Is there a way to extract a list of the Feature Class names (not the attributes or schema) from a File Geodatabase(s) to Excel using FME?

 

I know how to do this in python in ArcGIS Pro, but given I am relatively new to FME, I thought I would try it in FME.

Best answer by nielsgerrits

One way to do this I use a FeatureReader (initiaded by a Creator) with the format "Esri Geodatabase (File Geodb)" and select the parameter "Schema Features" under Schema/Data Features. This will return a schema feature for each Feature Class in a GDB. When you want to find all .gdb's in a directory you can use a Directory and File Pathnames FeatureReader and feed the resulting paths in the next FeatureReader. Sample workspace attached.

 

2023-01-24_05h11_59 

As an alternative you can do this as well using python in a PythonCaller.

View original
Did this help you find an answer to your question?

22 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • January 24, 2023

One way to do this I use a FeatureReader (initiaded by a Creator) with the format "Esri Geodatabase (File Geodb)" and select the parameter "Schema Features" under Schema/Data Features. This will return a schema feature for each Feature Class in a GDB. When you want to find all .gdb's in a directory you can use a Directory and File Pathnames FeatureReader and feed the resulting paths in the next FeatureReader. Sample workspace attached.

 

2023-01-24_05h11_59 

As an alternative you can do this as well using python in a PythonCaller.


vxn43
Supporter
Forum|alt.badge.img+18
  • Author
  • Supporter
  • January 24, 2023

Thanks, this is exactly what I needed.

 

What is the best way to include the Feature Class Geometry Type (Point, Line, Polygon) in the result?


Forum|alt.badge.img+2
  • January 24, 2023

@timh​ The schema includes a list attribute with the geometry and another with all the attributes:

  • fme_geometry{0} fme_point
  • attribute{7}.name SCAMAX
  • attribute{7}.native_data_type range_domain(ScaleMaximumDomain:integer:1:999999999)

an domains, if you select resolve domains


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 8, 2023

Hi

 

I was able to extract the MDB Names succesfully..

 

I want to write dynamically the features in MDB to GDB similar name

  • MDB name to GDB Name
  • MDB FC to GDB FC
  • All attributes of that Feature class of MDB to the NEW FC of GDB

Any Guidance and workaround Please

I have attached the template

 

Thank U


nielsgerrits
VIP
Forum|alt.badge.img+54
adnanyazdani wrote:

Hi

 

I was able to extract the MDB Names succesfully..

 

I want to write dynamically the features in MDB to GDB similar name

  • MDB name to GDB Name
  • MDB FC to GDB FC
  • All attributes of that Feature class of MDB to the NEW FC of GDB

Any Guidance and workaround Please

I have attached the template

 

Thank U

You are looking for a dynamic workflow. Please see Tutorial: Dynamic Workflows

 

Steps to get what you need:

  • Before the FeatureReader, use a FilenamePartExtractor to get the mdb name from the path_windows attribute.
  • Connect FeatureReaders Schema and Generic outputports to one FeatureWriters inputport.
  • In the FeatureWriter
    • Set the Format to GDB.
    • Set the Dataset to an outputfolder, use the MDB filename attribute in the path.
    • Enable the "Dynamic Schema Definition" checkbox.
    • In the tab User Attributes, radiobutton Dynamic and remove all attributes.

adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 8, 2023

Thanks for your guidance

 

I followed your steps

Its didnt create any GDB in the output i provided

Set the Dataset to an outputfolder, use the MDB filename attribute in the path

 

Can you please have a look

 

Thanks

 

 


nielsgerrits
VIP
Forum|alt.badge.img+54
adnanyazdani wrote:

Thanks for your guidance

 

I followed your steps

Its didnt create any GDB in the output i provided

Set the Dataset to an outputfolder, use the MDB filename attribute in the path

 

Can you please have a look

 

Thanks

 

 

  • Remove the AttributeExposer and the Sorter, you do not need those.
  • Connect the Schema outputport from the FeatureReader to the same inputport in the FeatureWriter. The schema feature carries the schema, column names and types, geometry type.
  • In the FeatureWriter, update the path to something like
C:\TMP\New folder (32)\output\@Value(path_rootname).gdb

 


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 8, 2023
nielsgerrits wrote:
  • Remove the AttributeExposer and the Sorter, you do not need those.
  • Connect the Schema outputport from the FeatureReader to the same inputport in the FeatureWriter. The schema feature carries the schema, column names and types, geometry type.
  • In the FeatureWriter, update the path to something like
C:\TMP\New folder (32)\output\@Value(path_rootname).gdb

 

Can you send me screenshot for 2nd point please

 

Didnt get exactly

 

Apologies


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 8, 2023

Followed the steps and did the changes and got the results in different way

feature classes were not created instead a schema layer created and asking spatial relation

 

image.png


nielsgerrits
VIP
Forum|alt.badge.img+54
adnanyazdani wrote:

Followed the steps and did the changes and got the results in different way

feature classes were not created instead a schema layer created and asking spatial relation

 

image.png

Ah now I see, the sample you used was to get the schema's. You want to do the data. So you need to change the FeatureReader's format from Schema (Any Format) to Esri Geodatabase (Personal Geodb).

 

2023-11-08_13h35_01


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 8, 2023

I received following after the changes as

and didnt great any GDB


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 8, 2023

Log file attached..

 

Apologies for to many queries


nielsgerrits
VIP
Forum|alt.badge.img+54
adnanyazdani wrote:

Log file attached..

 

Apologies for to many queries

Pretty please with sugar on top, also connect the schema output port to the featurewriter inputport, as printscreened in my previous answer.


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 8, 2023
nielsgerrits wrote:

Pretty please with sugar on top, also connect the schema output port to the featurewriter inputport, as printscreened in my previous answer.

I read mail directly and worked on it and didnt notice the screenshot

Apologies @nielsgerrits​ 

 

By the way, I received the error and it doesnt write all feature class of first MDB and gave an error..

 

Your kind suggestion is required

 

Thank U

 

image.png


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 8, 2023

Sorry forget to attach log file

Log file attached

 


nielsgerrits
VIP
Forum|alt.badge.img+54

I surrender :/ this should just work, and I run out of time.


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 9, 2023
nielsgerrits wrote:

I surrender :/ this should just work, and I run out of time.

No Problem..

 

I'm trying to figure it out .

 

Thank U


nielsgerrits
VIP
Forum|alt.badge.img+54
adnanyazdani wrote:

No Problem..

 

I'm trying to figure it out .

 

Thank U

Here I am again. :) Created a new sample workspace for you. You should only have to change the input, the output and the FeatureReader to personal geodatabase mdb, I do not have 32 bit FME installed so I can't select that one now.

 

I added AttributeCreators and a Sorter to sort the data and schema files, to force the schema features arrive at the FeatureWriter before the data features. This is what your log is complaining about.

 

Let me know if it works.


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 10, 2023
adnanyazdani wrote:

No Problem..

 

I'm trying to figure it out .

 

Thank U

Thanks @nielsgerrits​  for the support..

 

I just want to know as even in my Machine , I too have latest edition of FME 2023.1.1.1 which is 64 Bit..

 

As 32bit is stopped since 2021 , In this case we dont have any other possibility or I need to Setup older version and then migrate it..

 

Please can you Guide me

 

Thanks Again

 


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 18, 2023
adnanyazdani wrote:

No Problem..

 

I'm trying to figure it out .

 

Thank U

Thank you for the Workspace

 

Its Working


nielsgerrits
VIP
Forum|alt.badge.img+54
adnanyazdani wrote:

No Problem..

 

I'm trying to figure it out .

 

Thank U

Great :) thanks for the feedback. I assume you installed a a 32 bit 2021 fme?


adnanyazdani
Contributor
Forum|alt.badge.img+2
  • Contributor
  • November 18, 2023

Yes. You are right

 

But with Higher version , Need to figure out


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings