Skip to main content
Solved

How to download and save multiple DTM zip files from CSV with URLs. Need help with settings for extracting individual files


gattogis
Contributor
Forum|alt.badge.img+1
How to download and save multiple DTM zip files from CSV with URLs. Need help with settings for extracting individual files

Best answer by takashi

gattogis wrote:

Thanks. I did the same thought. In my case the csv already contains a FILENAME column, but I’m not able to set this FILENAME in the Output Filename field.

"C:\Users\Francesco\Desktop\dtm austria" is a folder path, is not a User Parameter. You don't need to quote it by $( ).

Try setting this string to the Output Filename parameter.

C:\Users\Francesco\Desktop\dtm austria\@Value(FILENAME)

See here to learn more aboud User Parameters.

https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Form/Workbench/published_private_parameters.htm

View original
Did this help you find an answer to your question?

8 replies

takashi
Evangelist
  • December 1, 2023

Hi @gattogis​ ,

I think you can read URLs from the CSV file with CSV reader, extract filename part from each URL with FielnamePartExtractor, and download the DTM zip file with HTTPCaller into a specific folder.

HTTPCaller parameters setting looks like this. Assuming that "url" stores a URL read from CSV, "DONWLOD_FOLDER" is a user parameter spacifies a folder path to which you would like to downlaod the DTM zip files, and "_filename" stores a zip filename extracted from URL with FilenamePartExtractor. 

httpcaller-paramers-example


gattogis
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • December 1, 2023
takashi wrote:

Hi @gattogis​ ,

I think you can read URLs from the CSV file with CSV reader, extract filename part from each URL with FielnamePartExtractor, and download the DTM zip file with HTTPCaller into a specific folder.

HTTPCaller parameters setting looks like this. Assuming that "url" stores a URL read from CSV, "DONWLOD_FOLDER" is a user parameter spacifies a folder path to which you would like to downlaod the DTM zip files, and "_filename" stores a zip filename extracted from URL with FilenamePartExtractor. 

httpcaller-paramers-example

Thanks. I did the same thought. In my case the csv already contains a FILENAME column, but I’m not able to set this FILENAME in the Output Filename field.


takashi
Evangelist
  • December 2, 2023
gattogis wrote:

Thanks. I did the same thought. In my case the csv already contains a FILENAME column, but I’m not able to set this FILENAME in the Output Filename field.

Could you please share a few rows of the CSV table?


gattogis
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • December 2, 2023
gattogis wrote:

Thanks. I did the same thought. In my case the csv already contains a FILENAME column, but I’m not able to set this FILENAME in the Output Filename field.

This is a simplified version of my csv with only 2 rows, for my tests

 

image


takashi
Evangelist
  • December 2, 2023
gattogis wrote:

Thanks. I did the same thought. In my case the csv already contains a FILENAME column, but I’m not able to set this FILENAME in the Output Filename field.

I was able to download the files from urls described in the CSV table.

However, it took very long time. ​Possibly you may have to set a large value to the Transfer Timeout Length parameter of the HTTPCaller.

csv-reader-httpcaller


gattogis
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • December 2, 2023
gattogis wrote:

Thanks. I did the same thought. In my case the csv already contains a FILENAME column, but I’m not able to set this FILENAME in the Output Filename field.

I still receive translation FAILED message as:

2023-12-02 21:47:43|      |     |INFORM|Starting translation...
2023-12-02 21:47:44|      |     |INFORM|Undefined macro `C:\Users\Francesco\Desktop\dtm austria' dereferenced in file `C:\Users\Francesco\Documents\FME\Workspaces\wb-xlate-1701550060797_22284'
2023-12-02 21:47:44|      |     |INFORM|Program Terminating
2023-12-02 21:47:44|      |     |INFORM|Translation FAILED.

I have the workspace shown below:

 

Screenshot 2023-12-02 214707


takashi
Evangelist
  • Best Answer
  • December 2, 2023
gattogis wrote:

Thanks. I did the same thought. In my case the csv already contains a FILENAME column, but I’m not able to set this FILENAME in the Output Filename field.

"C:\Users\Francesco\Desktop\dtm austria" is a folder path, is not a User Parameter. You don't need to quote it by $( ).

Try setting this string to the Output Filename parameter.

C:\Users\Francesco\Desktop\dtm austria\@Value(FILENAME)

See here to learn more aboud User Parameters.

https://docs.safe.com/fme/html/FME-Form-Documentation/FME-Form/Workbench/published_private_parameters.htm


gattogis
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • December 2, 2023
gattogis wrote:

Thanks. I did the same thought. In my case the csv already contains a FILENAME column, but I’m not able to set this FILENAME in the Output Filename field.

Thanks! That worked fine. Now i understand where the problem was.


Reply


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