1

Is it possible to set the Writer in FME to always write to the same location as the Reader (ideally a FeatureReader) so that the output is always saved in the same folder location as the input?

Ideally, I would like to read in a feature class from a geodatabase, and after analysis, write it out as a shapefile in the folder that the geodatabase is saved in.

2
  • yes use the path reader community.safe.com/s/article/… you can use the string replacer/concatenator to tell your writer the current directory you want.
    – Mapperz
    Oct 8 at 15:30
  • Sorry I'm not familiar with the path reader, I have just followed the instructions in the link you sent, but how do you use this to direct the writer?
    – xxenox
    Oct 8 at 16:01
2

Yes, this is fairly straightforward.

  1. Open the properties for the source feature type (table) and expose the Format Attribute called fme_dataset. That tells us the full source dataset path.

enter image description here

  1. Add a FilenamePartExtractor transformer to work on the fme_dataset value. This gets us the source dataset folder.

enter image description here

  1. Under the writer parameters open the Fanout dialog box. Set the destination folder to be the root folder and the fanout expression to the _dirpath attribute. This uses that folder as the output location of the Shapefile writer.

enter image description here

That will get you a shapefile written to the same location as the gdb folder for each gdb table:

enter image description here

3
  • This worked great. Is it possible to use a similar technique to save a feature class within the same geodatabase that the original input came from? I can't get this to work in the same way
    – xxenox
    Oct 14 at 7:36
  • Yes, you should be able to point back to the same geodatabase. But maybe you need to tag it as an update rather than an insert? What sort of error are you getting? Oct 18 at 19:36
  • Thanks, I managed to get this to work. I used the same method (exposing the fme_dataset to get the source path (dirpath) and also the file_name (geodatabase)), so my fanout expression is @Value(_dirpath)\@Value(_filename).
    – xxenox
    Oct 25 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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