[GIS] How to unzip multiple folders with FME 2014

compressionfme

I have downloaded 21 zipped folders using the HttpFetcher transformer and I cannot figure out how to get FME to unzip these files.

I've seen some posts about using either the TclCaller or PythonCaller transformer, but I've tried that without luck.

Does anyone out there know how to unzip directories, using FME?

Best Answer

This one's a little trickier than it probably should be.

Your options are as follows.

Reader/FeatureReader

If the zip files you want to read are fixed, you can you/should use a Reader/Feature Reader. These can decrypt the zip file automatically.

You may also be interested in this Community Answer which covers the structure of zip files: http://fmepedia.safe.com/AnswersQuestionDetail?id=906a0000000cl94AAA

HttpFetcher

If you must use a HttpFetcher, you will need to write the contents of the response to your disk before unzipping it. You do this with an AttributeFileWriter. Then there are various options for unzipping:

  • a FeatureReader, as above (optimal)
  • some Python (i.e.: exec unzip -oq @Value(_ZipFileName)) followed by a FeatureReader (suboptimal)

For more information on the process see: http://fmepedia.safe.com/articles/How_To/Read-Zip-File-from-URL-as-Source-Data-for-Workspace ; However, Note that this is dated 2011, so doesn't account for the fact that FME as of 2013 supports native ZIP file reading with Readers.