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

  • December 1, 2023
  • 8 replies
  • 83 views

gattogis
Contributor
Forum|alt.badge.img+2
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

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

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.

8 replies

takashi
Celebrity
  • 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+2
  • Author
  • Contributor
  • 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

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
Celebrity
  • December 2, 2023

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+2
  • Author
  • Contributor
  • December 2, 2023

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
Celebrity
  • December 2, 2023

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+2
  • Author
  • Contributor
  • December 2, 2023

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
Celebrity
  • Best Answer
  • December 2, 2023

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+2
  • Author
  • Contributor
  • December 2, 2023

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.