GPService place output file in download folder

2884
5
07-01-2016 08:52 AM
SebastiánVázquez
New Contributor II

Hi there!


I am currently trying to develop a python script which output should be downloadable as a file. It should behave just like a printing service, that is, sending back a link to the result.  The issue is that I still haven't found out how to copy the result  to the output folder and then make a link pointing to it. Do I have to send that path as an input parameter? Is there a special name - arcpy.env.outputfolder or similar- that would help me?

Thank you very much in advance

Sebastián

0 Kudos
5 Replies
JonathanQuinn
Esri Notable Contributor

You'll want to set the output as a File data type and set it as an Output and Derived.  Once the task is completed in the client, it should prompt the browser to ask you to download the file.

SebastiánVázquez
New Contributor II

Thank you very much Jonathan

Please let me know if I am getting it right. I would process the file in an ordinary folder (e.g. c:\temp), then I would set it as an output parameter (e.g. arcpy.setParameter(1, c:\temp\txtfile.txt)) and finally, once the task is finished, the system itself would copy that file to the GPService output folder (which is a virtual directory too) and send a link back. Am I right?

Is there any help topic in which I could find a clear directive on this topic (output parameters in GPService)? I have been trying by myself, but couldn't find any

Once again, thank you very much in advance

Regards,

Sebastián

0 Kudos
PanagiotisPapadopoulos
Esri Regular Contributor

It is better to save the file on Scratch Folder (arcpy.env.scratchFolder). As Jonathan Quinn  said if you set the output parameter as File type then once the task is completed in the client, it should prompt the browser to ask you to download the file.

0 Kudos
SebastiánVázquez
New Contributor II

I just made a simple test and....it works!!

Thank you so much

0 Kudos
ThomasColson
MVP Frequent Contributor

On-Demand GPS Provisioning Widget Thingy: Step 1

Complicated steps...but it does demonstrate how to use the scratch folder to present the client a download option.