FME: Setting a Raster Output Name Dynamically

I have started to use FME more and more for data imports and data processing. I like automating any workflow as much as possible, and FME is great for this. For one part of a project had a number of similar raster processes that could be defined in a single workspace, as long as parameters could be used.

The system documentation is normally both detailed and clear, and FME also has very good support and community web sites.  However in this case it took a lot of documentation reading and trial and error to work out how to change the ouput filename of a model. This may be obvious to experienced users of FME, but it had me stumped for a while.

raster_naming2

The steps involved are simple in retrospect, and are as follows:

Create your raster model as normal, but add an additional AttributeSetter transformer, as shown in the screenshot above.

Next create a new Published Parameter that will be used to pass in the output raster filename. The source dataset and destination folder can also be set to be published parameters to provide full flexibility.

raster_naming3

Next right click on the newly created published parameter and check the AttributeSetter value item. This creates the link between the parameter and the value for the attribute.

raster_naming4

If you look at the AttributeSetter’s properties they should now look similar to below.

raster_naming5

Finally look at the properties for your output raster dataset. Make sure the “Fanout By Attribute” is checked and the attribute is set to fme_basename. This sets the output filename to be the same as the fme_basename attribute value, which is now set via an input parameter.

raster_naming1

The model is now ready to run from the command line or through a batch process, for one or many raster transformations. The output filename parameter does not require a .tif extension.

    fme.exe raster_sample.fmw
          --SourceDataset_ARCVIEWGRID C:\Grids
          --DestDataset_GEOTIFF C:\Rasters
          --OutputFileName MyOutputRaster


Discussion has just started! Join in...

  1. Rob says:

    Seth -

    Thanks for this post – just what I needed this morning!

    ATB

    Rob

Leave a Reply

Your email address will not be published. Required fields are marked *

Comment

You may use these tags : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>