Skip to main content
Question

Multiple url via the HTTPFetcher


fmelizard
Safer
Forum|alt.badge.img+18
Hi,

 

 

Was wondering if anybody managed to use the HTTPFetcher (saving the files) with multiple url's.

 

 

Any suggestions are welcome.

 

Itay

10 replies

takashi
Influencer
  • May 10, 2014
Hi Itay, long time!

 

 

Both target URL and output filename can be specified as Attribute Value, so I would try to send multiple features having pair of URL and  filename to the HTTPFeatcher as initiators.

 

 

Takashi

fmelizard
Safer
Forum|alt.badge.img+18
  • Author
  • Safer
  • May 10, 2014
Hi Takashi,

 

Yes, been busy :)

 

I actually didnt think about using the Target attribute but the file name (that cannot be set by an attribute or parameter), thanks for the redirection.

 

Itay

gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 12, 2014
Hi Itay!

 

 

I do that, like Takashi said, by parsing the target url using attributes:

 

 

for example :

 

http://geodata.nationaalgeoregister.nl/ahn2/extract/ahn2_05m_ruw/@Value(Blad).tif.zip

 

 

This one is used to dinamically fetch rasters.

 

In this case i fetch the downloadpage.xml in  a separate fetcher and extract the url, using the ahngridfile i build the url using another fetcher.

 

 

U could do @Value(url)@Value(Blad).@Value(extension) or something like it.

fmelizard
Safer
Forum|alt.badge.img+18
  • Author
  • Safer
  • May 12, 2014
Hi Gio!,

 

 

Was nice meeting you in person at the fmewt, thanks for the answer, I got it working as suggested by Takashi.

 

 


fmelizard
Safer
Forum|alt.badge.img+18
  • Author
  • Safer
  • May 12, 2014
Now the next step, can I specify a download location directly in the httpfetcher?

takashi
Influencer
  • May 12, 2014
Setting like this?

 

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 13, 2014
Almost all fields have a pulldownmenu (arrow) on the rightside of the parameterpanel. Trough these u can acces attributes, parameters, stringeditor, conditionals etc. (no arithmetic...but you can circumvent that mostly)

 

 

donwloadlocation from my previous post:

 

G:\\LDNKDG\\KDGGE\\CGI\\Projecten\\2014\\G14-051_Rhijnhofweg_hoogtemetingen_in_digitale_kaart\\Analyse\\@Value(Blad).tif.zip

fmelizard
Safer
Forum|alt.badge.img+18
  • Author
  • Safer
  • May 13, 2014
Thanks guys, but I should have been more specific about what I want to acomplish.

 

Basically when no output filename is spcecified, the file downloaded will be located at the same location as the workspace is.

 

I wanted a small variation on that, basically downloading to a sub folder of the FME_MF_DIR parameter.

 

By adding $(FME_MF_DIR)\\Download\\@Value(Id) I basically got that, now that made me wonder if FME will create the sub folder if it does not exist, unfortunatly that is not possible by only using the HTTPFetcher.

 

But then I can live with that too,

 

Cheers,

 

Itay

takashi
Influencer
  • May 13, 2014
New folder can be created with a simple script. For example:

 

-----

 

# PythonCaller script example

 

import fmeobjects, os

 

def createFolder(feature):

 

    path = feature.getAttribute('_folderpath')

 

    if not os.path.exists(path):

 

        os.makedirs(path)

 

-----

fmelizard
Safer
Forum|alt.badge.img+18
  • Author
  • Safer
  • May 14, 2014
Thanks Takashi.

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