Skip to main content
Question

Seeking Guidance on Iterating CSV Files and Configuring Table View Schema in Feature Reader


dworkhk
Participant
Forum|alt.badge.img

I'm currently working on a task where I need to iterate through each CSV file found within specified folders and convert them to SHP files. My approach involves using the path to identify all files under the specified folder and then filtering them by extension using an attribute filter. However, when I use the FeatureReader to read the CSV files, it reads all the CSV files and combines them into one table.

I'm looking for guidance on how to set up a loop to iterate through the files one by one, rather than reading them all at once. Additionally, I've noticed that there are no columns shown in the visual preview, and I have to manually check all the columns in the column options to visualize them in the preview.

Is there a way to configure the table view/data schema in the FeatureReader to address these issues? Any advice or suggestions would be greatly appreciated. Thank you!

2 replies

nielsgerrits
VIP
Forum|alt.badge.img+54

How I do this:

  • Creator to initiate process.
  • FeatureReader directory reader to find all CSV files.
    • Single output port.
    • AttributeExposer to expose path_windows.
  • FeatureReader CSV reader to read every CSV file found in the previous step.
    • Single output port.
    • Merge attributes.
  • AttributeExposer to expose attributes with coordinates.
  • Convert to geometry.
  • SchemaScanner to generate schema feature for each original CSV.
  • FeatureWriter to write shapes.
    • Dynamic writing based on schema feature.

danilo_fme
Evangelist
Forum|alt.badge.img+45
  • Evangelist
  • May 26, 2024
nielsgerrits wrote:

How I do this:

  • Creator to initiate process.
  • FeatureReader directory reader to find all CSV files.
    • Single output port.
    • AttributeExposer to expose path_windows.
  • FeatureReader CSV reader to read every CSV file found in the previous step.
    • Single output port.
    • Merge attributes.
  • AttributeExposer to expose attributes with coordinates.
  • Convert to geometry.
  • SchemaScanner to generate schema feature for each original CSV.
  • FeatureWriter to write shapes.
    • Dynamic writing based on schema feature.

Great solution!


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