Skip to main content

Hello FME Community,

In order to retrieve the list of fields from Shapefiles, I am currently using the following workflow: SchemaScanner => ListExploder => AttributeManager(Name).csv.

My objective is to perform this process on a set of Shapefiles contained in a folder and output the CSV files into another folder while keeping their original filenames.

However, I encountered some issues with this setup:

  1. Filename Issues: I am having trouble preserving the original filename for each output CSV file. The current workflow doesn't seem to carry over the original Shapefile name correctly.
  2. AttributeManager: I'm using AttributeManager to manage field names, but I'm unsure if I'm configuring it correctly for this task. It doesn't seem to handle the filename dynamically.

Do you have any suggestions or solutions to address these issues?

 

I use a FeatureReader with the type Directory and File Pathnames to scan for files. This is probably easier than the route you use. I use a Creator transformer to initiate the FeatureReader.

The FilenamePartExtractor is another transformer which might be handy with this kind of work.


 To simplify your workspace, you don’t need individual Readers for each SHP file, and you don’t need SchemaScanner either.

A FeatureReader for SHP, set to read “Schema Only”, and set to read an entire Folder, will in a single Transformer, give the Schemas for all SHP files which will contain all Fields in those Shape files.

For example, this FeatureReader reads the File Names and Fields for all 30 SHP files currently in my C:\Temp Folder.

 

 



This can then be directed to a single CSV Writer and use Fanout to make it write 1 CSV per 1 SHP file Schema

 



Writer Settings



Writer Parameters

 

Sample of 4 of 30 CSV Files Written
 



 

 


It works!

Thank you very much for your responses and for your help!


Reply