Skip to main content
Solved

Read Features from .zip or .tar.gz

  • July 22, 2017
  • 5 replies
  • 112 views

Forum|alt.badge.img

Hi,

My customers upload .zip or .tar.gz files to our server, I have a CSV reader, when I set the url (https://mydomain.com/customer1.zip) of a zip file with only 1 file, FME server works fine.

Now, a customer send us .tar.gz files with several files in it, for this spacific workspace I need to grab only one file form the package, there is a way to specify which will be the file in the url to process? I tried with https://mydomain.com/customer2.tar.gz\\students.txt with no luck, I manually convert to a zip file https://mydomain.com/customer2.zip\\students.txt but nothing works.

Thanks

VictorV

Best answer by pallegama

Hi @velasquezvictor,

I agree with @stalknecht of using HTTPCaller in this case. Since you are looking for using same parameter for local and remote files, you can use a workflow as depicted in the attached workspace template.

zipfile-reader.fmwt

In this workflow, source file path (local or remote) should be passed through 'Source' Published Parameter and the first Tester identifies and divert remote paths to download the zip/gz file before passing it to FeatureReader. This workspace works on both FME Desktop and FME Server.

Alternatively, you can think of writing a Startup Python script to do this.

Regards, Priyantha Pallegama

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

stalknecht
Contributor
Forum|alt.badge.img+22
  • Contributor
  • July 23, 2017

Hi Victor you should use a slash instead of a ". "

https://mydomain.com/customer2.tar/gzstudents.txt


Forum|alt.badge.img

Hi Victor you should use a slash instead of a ". "

https://mydomain.com/customer2.tar/gzstudents.txt

Hi I use https://mydomain.com/customer2.tar.gz/students.txt for gzip and https://mydomain.com/customer2.zip/students.txt for the zip file a none of them works. I receive the error: 

 

 

CSV reader: Failed to open file 'https://mydomain.com/customer2.tar.gz/students.txt' for reading. Please ensure that the file exists and you have sufficient privileges to read it

 

I verified and the zip/tar.gz file has students.txt inside.

 

 


stalknecht
Contributor
Forum|alt.badge.img+22
  • Contributor
  • July 27, 2017
Hi I use https://mydomain.com/customer2.tar.gz/students.txt for gzip and https://mydomain.com/customer2.zip/students.txt for the zip file a none of them works. I receive the error: 

 

 

CSV reader: Failed to open file 'https://mydomain.com/customer2.tar.gz/students.txt' for reading. Please ensure that the file exists and you have sufficient privileges to read it

 

I verified and the zip/tar.gz file has students.txt inside.

 

 

Do you run it from FME Server?

 

 

You can use the HTTPCaller to download the file locally and then use a FeatureReader to read it.

 

 


Forum|alt.badge.img
Do you run it from FME Server?

 

 

You can use the HTTPCaller to download the file locally and then use a FeatureReader to read it.

 

 

 

Hi,

 

 

I Would Like to use the same parameter for the reader to load locally, temporary upload or a remote file.

pallegama
Contributor
Forum|alt.badge.img+8
  • Contributor
  • Best Answer
  • July 27, 2017

Hi @velasquezvictor,

I agree with @stalknecht of using HTTPCaller in this case. Since you are looking for using same parameter for local and remote files, you can use a workflow as depicted in the attached workspace template.

zipfile-reader.fmwt

In this workflow, source file path (local or remote) should be passed through 'Source' Published Parameter and the first Tester identifies and divert remote paths to download the zip/gz file before passing it to FeatureReader. This workspace works on both FME Desktop and FME Server.

Alternatively, you can think of writing a Startup Python script to do this.

Regards, Priyantha Pallegama