Skip to main content
Question

.zip files

  • November 12, 2018
  • 7 replies
  • 274 views

anwe
Forum|alt.badge.img

Hello,

I am trying to build a workspace where PNG-images are processed into webmaptiles and then written to multiple sub-folders based on their zoom-level. However, I want the output result as a zip file which contains the folder-structure and can be written to a postgresql database. Does anyone know if there is a reader which does that? I don't seem to manage to keep the folder-structure when writing to a zip file using the PNG reader.

 

This job will anyway be published to a FME Server, so I have tried to upload it and run from there (with a PNG reader). I then get the correct sub-folder system from the data download url in a zip file, so that might be the way to go. I thought then of creating a second script that can call the result from the first script, but I am still very new to FME so not sure how that is done. Is there a reader which can call a result (url maybe?) from another fme server job?

 

Regards,

Anne

7 replies

nielsgerrits
VIP
Forum|alt.badge.img+53

I use the ZipArchiver custom transformer from the FME Hub for this. Works within one workbench:

- Write temporary data (FeatureWriter).

- Wait till data is ready, use outputport summary feature to fetch data and zip it.

- Delete folder with temporary data (SystemCaller) with RM (remove directory).

Let me know if you need more help.


takashi
Contributor
Forum|alt.badge.img+19
  • Contributor
  • November 12, 2018

Agree that the ZipArchiver does the trick.

Alternatively, the TempPathnameCreator and the FeatureWriter (File Copy writer) could also be helpful.

Assuming that the attribute called "_folder" stores the path to the folder to be zipped. The output feature from the FeatureWriter will have an attribute called "_dataset", which stores the resulting zip file path.

 


nielsgerrits
VIP
Forum|alt.badge.img+53
takashi wrote:

Agree that the ZipArchiver does the trick.

Alternatively, the TempPathnameCreator and the FeatureWriter (File Copy writer) could also be helpful.

Assuming that the attribute called "_folder" stores the path to the folder to be zipped. The output feature from the FeatureWriter will have an attribute called "_dataset", which stores the resulting zip file path.

 

Although I think the TempPathCreator isn't an easy one to start with it is a nice alternative for removing temporary files with a Systemcaller. Deep folder structures might give some problems as the temp path is quite deep itself.


damien
Forum|alt.badge.img
  • October 7, 2019
nielsgerrits wrote:

I use the ZipArchiver custom transformer from the FME Hub for this. Works within one workbench:

- Write temporary data (FeatureWriter).

- Wait till data is ready, use outputport summary feature to fetch data and zip it.

- Delete folder with temporary data (SystemCaller) with RM (remove directory).

Let me know if you need more help.

Hi @nielsgerrits,

My goal is to do a datadownload service on FmeServer and to have in the result .zip this tree

- 1 pdf file

- 1 csv file

- 1 .zip file with 2 .shp fils in

I'm following your solution.

I use a FeatureWriter to create a folder with the 2 shp in $(FME_SHAREDRESOURCE_TEMP) -> OK

I use a ZipArchiver to fetch the folder and zip it in $(FME_SHAREDRESOURCE_TEMP) -> OK

But do you know how I can recover my .zip to write it in my final writer ?

Thank You

 


damien
Forum|alt.badge.img
  • October 7, 2019
nielsgerrits wrote:

I use the ZipArchiver custom transformer from the FME Hub for this. Works within one workbench:

- Write temporary data (FeatureWriter).

- Wait till data is ready, use outputport summary feature to fetch data and zip it.

- Delete folder with temporary data (SystemCaller) with RM (remove directory).

Let me know if you need more help.

I think I have the solution with the writer filecopy.


nielsgerrits
VIP
Forum|alt.badge.img+53
damien wrote:

I think I have the solution with the writer filecopy.

@damien Excuses me for the delayed response, had some busy days. Did you work out a solution? You can use ZipArchivers or FileCopyWriters to write and collect the results to zip. I also use Emailers to send the response. If the file is to big for email (scan with the Directory an File reader) I copy it to a downloadlocation and let it be removed after 2 weeks.


damien
Forum|alt.badge.img
  • October 17, 2019
nielsgerrits wrote:

@damien Excuses me for the delayed response, had some busy days. Did you work out a solution? You can use ZipArchivers or FileCopyWriters to write and collect the results to zip. I also use Emailers to send the response. If the file is to big for email (scan with the Directory an File reader) I copy it to a downloadlocation and let it be removed after 2 weeks.

Hi @nielsgerrits. No problem ! Yes, I've found a solution. I use a FeatureWriter and a filecopywriter (I didn't know this writer before my comment) and with the good parameters I have exactly what I want.

 

Thanks !

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings