Skip to main content
Hi

 

 

I have a large number of folders of shapefiles that I would like to merge. Each folder contains shapefiles with different attributes and geometries. I would like to merge them so that each folder only contains three shapefiles, one for each geometry type. These files must also contain all the attributes from all the original shapefiles. I have been using OGR to do this up until now, but I would like to switch over to FME for this job.

 

 

I have tried several different ways to do this;

 

I have tried reading all files in a folder, putting them through a geometry filter, and then into three different dynamic Shape writers. This only yields output if I choose "fme_feature_type" as a filename, but then I end up with exactly the same files that I started with. If I choose another name, as I would like to, no features are written because they have no schema. (Even though the Shape reader is chosen as a schema source)

 

I also tried reading the files using Schema (Any format) Reader and Feature Reader, which yields the same result. If I turn off Dynamic Properties in the writers, I will get some output, but then the files will only contain the attributes that was read when I added the reader. I would like to use this workspace in combination with a Workspace Runner, so I assume the writers have to be dynamic.

 

 

I hope someone can point me in the right direction 🙂
You can use a schema reader, use in advanced mode, so you can have it read one or more directories (maybe using wildcards).

 

Expose the fme_geometrype, fme_featuretype formatparameters.

 

Group fme_featuretype on geometrytype, you can either use aggregator or liastbuilders.

 

The attributes and its datatypes for each fme_featuretype are contained in lists. You can merge these lists and remove duplicates. (explode and rebuild or use a customtransformer from the store)

 

Then assemble a csv or txt , with the fme_featuretype, its attributes, data types and values. (should still be grouped by geometrytype).

 

Use this csv as a schema for a dynamic schema driven writer with fanout on geometrytypes.
Thank you for the reply Gio! 

 

 

I have had a sneaking suspicion that there have been an easier solution to my problem in earlier versions of FME. I tried my method with a geometry filter and three dynamic writers, each with the folder name + "_line" as feature type (shape file) name, in FME2014. And it worked! The result was one shapefile for each geometry type, containing all the features and attributes from the original files.

 

 

 

There was a change in the feature type general properties window on Build 15445 (febuary 2015), removing the separate "Configure Dynamic Schema Parameters" window. I'm not sure if that was all cosmetic, but it either broke dynamic feature type naming or changed it to the point where I can no longer figure it out. I'll use FME2014 for the time being, but I hope someone at Safe will have a look at this.
I see now that my problem was what Safe describes here https://knowledge.safe.com/articles/Error_Unexpected_Behavior/Dynamic-Workspace-using-FME-2015-1-Cannot-Find-the-Schema-Definition

Reply