2

I am reading some feature types in FME, doing some processing and writing as ESRI shape file format. Is there a way I could delete all the attributes from a table that are not necessery?? I need my shape files as small as possible (file size). I know python caller can probably do something like this but maybe there is an easier way.

enter image description here

2

1 Answer 1

2

So what's happening here is that you are using what we call "Dynamic" mode. It means that FME automatically outputs exactly the same data that is input (in terms of attributes). The idea is so that you can create a workspace that converts any source dataset, regardless of schema (data model).

Using the AttributeRemover won't help because the output schema is already being set by the input. The reason you get no output at all is because one attribute provides the name of the feature type to write and you're probably removing that attribute. The log would probably say something like "x features didn't match a known feature type and were discarded".

So... do you need to have a dynamic solution? If the source data is always the same in terms of layers and attributes, then the answer is no. What you should do is recreate the workspace without dynamic mode turned on. Then you can manually edit the output feature types to have only the attributes you need.

But... if you do need a dynamic solution then it becomes more complicated. That's because FME needs to know what schema to write, but doesn't know where to get that information, which could vary from run to run anyway. You need to tell FME what to write - for example, you could set up a text file with a list of attributes and use that.

I won't go into the dynamic side too much, because I'm hoping that you don't necessarily need to use it. But if you do, then I can point you to some useful resources that will help.

Oh... please don't resort to the PythonCaller! There should be a non-programmatic way to handle this scenario!

4
  • unfortunately I need it dynamically because I want to make it "automated process" with user parameters... the thing is that each time layers (feature classes) have different names and I want them to be named the same way as input names! That´s why dynamic. The only difference is that I need these layers without attributes. Even attribute tables are always different which make it more difficult. What I am looking for is something like to check each attribute filed and if its not necessary delete otherwise keep it.
    – gisgis
    Feb 2, 2022 at 21:59
  • 1
    So what you can do is make the reader part dynamic (in terms of layers) but static writer feature types. The easiest way is: 1) to set up a non-dynamic workspace, 2) remove all of the attributes on the writer, 3) Set the writer feature type name to fme_feature_type, 4) Open the reader feature type and set Merge Feature Type to On (with * as the filter). That way it'll read all the layers you want - and write them back out to the same layers - but you won't have any output attributes. Feb 2, 2022 at 22:14
  • 1
    I made a short video of what I think you need: youtu.be/LHezY27EONs (maybe have to wait a sec, it's still processing on YouTube) Feb 2, 2022 at 22:27
  • 1
    this video solved the question. Thank you so much for your effort.
    – gisgis
    Feb 3, 2022 at 7:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.