Skip to main content

Hi,

I've trawled the knowledge center and have not found a topic or question which covers this, so hopefully I'm not repeating a previous post..

I'm trying to merge two MapInfo TAB files (each with the same structure), but coming from different 'Directory and File Pathnames' readers. Let's call the files A and B.

File A is the master layer and file B contains features that I want to insert into File A.

If these files were read in as MapInfo TAB readers, it would be simple to append the two together. However, as the writer has to be dynamic and the readers are Directory and File Pathnames I cannot do this easily.

I have got to a point where the features from File B are being inserted into File A (and writing out in the correct structure) - using FeatureReaders and FeatureMergers. However, the attributes aren't coming through from File B,only the geometry is apparent in the resulting file that is written. There are no attributes present except for the ones coming from File A.

If anyone can provide any help on this, it would be very much appreciated!

I think - if I understand this correctly - you need two workspaces.

The first workspace runs the PATH readers and send the names of the files to the second workspace. That second workspace uses the filenames as the FeatureReader sources. But those filenames are also used in a Reader as Resource in order to fetch the schema. Then you write to a dynamic workspace that uses that schema.

I'm just working on it to see if I can create a demo, but that's the way I am going to try.

Whether you actually need the PATH readers I am going to think about as well.


OK, I've got it working, but I have to say that it was so complex I wonder if either I misunderstood or what you need to do could be done another way.

Anyway, it's mostly based on this article.

You say "each with the same structure" but I'm guessing the attributes must be different or else you could just merge the data together. So the point is you need to have one workspace create a list of source datasets and pass that to the second workspace. The second workspace reads the data, reads the schema of the datasets, combines the schema into one, merges it onto the data itself, and writes it as a dynamic translation using the schema on the features.

Anyway: Master Workspace Slave Workspace Source Data


Hi @johnwk, if each source feature type has different data structure and you want to merge their schemas into a single destination feature type schema, I think you can apply the tips described in this Knowledge article.

FME Knowledge Center | Dynamic Workflows: Destination Schema is Derived from a Schema Feature

The attached demo workspace might work as well as @Mark2AtSafe's solution: schemamerge.zip (FME 2016.1.2)

However, if "each with the same structure" literally means that the source feature types have the same data structure (i.e. schema), just send the schema feature coming from the FeatureReader <Schema> port to the dynamic writer feature type. That's it.


Hi @johnwk, if each source feature type has different data structure and you want to merge their schemas into a single destination feature type schema, I think you can apply the tips described in this Knowledge article.

FME Knowledge Center | Dynamic Workflows: Destination Schema is Derived from a Schema Feature

The attached demo workspace might work as well as @Mark2AtSafe's solution: schemamerge.zip (FME 2016.1.2)

However, if "each with the same structure" literally means that the source feature types have the same data structure (i.e. schema), just send the schema feature coming from the FeatureReader <Schema> port to the dynamic writer feature type. That's it.

I agree with @takashi -- it should be quite straight forward depending on the "same structure" definition. I'm also curious why, in your original post, you needed a FeatureMerger -- that would seem to be connecting/joining features from file A to file B based on a key which would seem something yet different. If you could perhaps post a pic of your workspace and of the column definitions in A and B that might shed light on things.

Reply