Drawing inspiration from this Safe software blog post we have developed an FME workflow that allows the user to update multiple MAPublisher templates with additional layers using two workspaces and a workspacerunner transformer.
The folder structure for the project follows one possible standard arrangement. A data folder contains the shapefile that is being added to the existing .ai files. An output folder gathers the intermediate .ffs files generated by FME that pass the data to MAPublisher. The templates folder contains the .ai files that will have the layer added to them. Finally, the workspaces folder contains the two workspaces required for the transformation.
Folder StructureData FilesOutput FilesTemplates Files
The runner workspace uses a path reader to get the filenames and paths of the .ai files. A filter is applied to make sure only files with the extension ".ai" are read. After the path reader, an attribute creator adds the path for the output .ffs files as an attribute. This is dynamically calculated based on the filenames of the input .ai files.
The full paths to the template files and the paths to the output FFS files are passed as published parameters to the worker workspace. Two published parameters have been created in the worker workspace and linked to parameters in the MAPublisher writer. This allows the writer to take the values passed from the runner workspace. The worker workspace is run once for every file that is in the folder of ai files, and these published parameters update dynamically for each one.
The worker workspace has a shapefile reader that reads in the layer that is going to be added to each template. At this point, multiple readers or other transformers could be added to increase the complexity of the transformation.
When the runner workspace is launched each template is opened up, the shapefile is read and added to a new MAPView in the MAPublisher document. Equally, it could be added to an existing MAPView with a matching coordinate system. These documents can be left open as shown here, or with the addition of another published parameter new output .ai files could also be specified.
Please sign in to leave a comment.