Skip to main content

I am fairly new to FME, and I am trying to write a custom
writer using Java. I went through the
sample file in the installer, and I managed to put together a functioning
writer. However, I am stuck on how to
deal with multiple feature types. For
example, if I am using an ESRI-Shape reader, and my dataset has 4 shape files,
I want my output to also have the same 4 files.

At the present time, my writer has a directory for the
output. So, when I add my writer, I choose
the directory for the Dataset option and click OK. Then I get the prompt for “Select Feature
Type”, and I select all. This creates separate
Feature Type records, named for each shape file, as I would expect. However, when I execute my code … it does not
seem like I have access to the Feature Type Name parameter. If I create a separate writer for each
feature type, I can get the data from the DefLines, but that doesn’t seem like
the correct way to do it. From using
stock writers, such as ESRI-Shape, it seems like the correct way is to create
one writer, and use this parameter somehow … but I can’t seem to figure out how
to access it.

Hi,

If your requirement is

If the input is 1 shape file then the target should have 1 shape file or If the input is 4 shape files then the target should have 4 shape files

then there is no need of any custom writer. If my understanding is different do let me know...


Hi @steveowens

I do have to wonder if writing a custom writer in Java is the best solution for you here. I suppose it depends on what you are trying to achieve and how you are going to deploy this, but it's unusual for a new user to need to do this.

Anyway, perhaps the best thing to do is to sign up to our developer partner program. You can find out more information about it here. That way you can use the support team as a source of help for problems like this, and they will also be able to explain if there is a better solution for your goal.

I hope this is of use,

Regards

Mark

 

Product Evangelist

 

Safe Software

Hi,

If your requirement is

If the input is 1 shape file then the target should have 1 shape file or If the input is 4 shape files then the target should have 4 shape files

then there is no need of any custom writer. If my understanding is different do let me know...

The output format is not shape, it is a proprietary format. I was just using shape as an example of a case where you might have multiple files in a single reader/writer.

 

 

 


Hi @steveowens

I do have to wonder if writing a custom writer in Java is the best solution for you here. I suppose it depends on what you are trying to achieve and how you are going to deploy this, but it's unusual for a new user to need to do this.

Anyway, perhaps the best thing to do is to sign up to our developer partner program. You can find out more information about it here. That way you can use the support team as a source of help for problems like this, and they will also be able to explain if there is a better solution for your goal.

I hope this is of use,

Regards

Mark

 

Product Evangelist

 

Safe Software
If it's a proprietary format as you mentioned above, then a custom solution is obviously required, so that's good.

 

 

Still, if it's not a complex format it might still be done easier than a Java plugin. For example, we have a custom format (fds file) option for reading data using a workspace, and combined with the FeatureWriter transformer I think you could make it into a custom writer. Anyway, I'm throwing out the idea for you to make of it what you will - and as a record for any other users who find this question and are looking for suggestions.

 


Reply