FME currently doesn’t provide a way to explicitly define the output order of Feature Types in a workspace. In the Navigator you can reorder Readers and Writers to control the order in which they are run, but unfortunately you cannot do the same with the Feature Types they read and write respectively.
By default when you write layers to MAPublisher from FME using FME Auto, the layers are arranged first by geometry (text first, then Points, Lines, Polygons and lastly Images), then alphabetically by layer name. This behaviour can be changed by unchecking the FME Auto Parameter “Sort Layers by Geometry”. Once this has been turned off, MAPublisher will display layers in the order they are received from FME. Using this behaviour, some FME transformers and a Feature Type fanout (or new to 2015.1, specifying the Feature Type name) we can control the order of the layers in MAPublisher for optimal cartographic output.
The first thing we want to do is to add some input Feature Types.
We will then create a template AttributeCreator Transformer to give each layer two attributes: MP_LayerName and MP_Order. MP_LayerName will define the name of the layer in MAPublisher and MP_Order will determine the order the layer is passed to MAPublisher; hence the order in which it is displayed.
Each Feature Type will be connected to a copy of the AttributeCreator Transformer and the values will be populated for that layer. The layer with an order of 1 will be on top with larger numbers descending below.
Once this is done, all the inputs can be connected to a Sorter Transformer. The Sorter will be set to numeric and ascending.
Finally, the MAPublisher writer is added. The Sort by Geometry parameter needs to be set to No and the Feature Type name should be set by the MP_LayerName attribute we created earlier. This replaces Feature Type fanouts and has slightly new behaviour at FME 2015.1. It is explained more fully (here).
Once we run the workspace, we’ll see the layers in the Adobe Illustrator Layers panel in the exact order we specified.