Zip File Handling
The Basic Desktop course covered how data can be read directly from a zip file. However, it is also possible to write data to a zip file.
Zip files are a convenient way to write output datasets that need to be handled as a single unit.
For example, a single Shape feature type consists of several files; shp, shx, dbf, prj, etc. A Shape dataset can consist of multiple feature types. So, in a scenario where the output data needs to be post-processed – uploaded to a web site, say – it’s more convenient to handle a single zip file than multiple data files.
Zip File Writing
The simplest way to create a zipped output is to simply change the file extension to .zip in the output dataset field:
A shortcut button for setting a zip extention exists on most Writer dialogs:
Once set, a small icon in the dataset field indicates the zipped status:
When the workspace is run the log file reports the zip creation:
Finished updating output zip file `C:\FMEData2016\Output\Parks.zip'
And the output is, indeed, a zipped dataset:
|Sister Intuitive says…|
I’m Sister Intuitive from the order of Perpetual Translations. I’ll provide you with spatial guidance throughout this chapter.
Some users may want to zip data in order to upload it to a different location as a single entity. A user parameter can be used in a TCL or Python script to find the name of the file just written, and the FeatureWriter transformer (new in FME2016) also provides the name of the dataset as an attribute.