3

I would like to save a file in the output folder on the ArcGIS Server and then provide a link for the user so he can download it.

I have two problems:

I can't figure out how to access the output folder in arcpy - because the geoprocess has to run locally first and only then it is uploaded to the server - how do i tell ArcGIS to use a folder on the server on my local machine, it doesn't make any sense to me.

I understand that it is possible to download a file via rest once it is the output folder - but what exactly is the URL I'm supposed to give the client? The ArcGIS Server seems to change the name of the directory I create.

  • I've got logic in an ArcObjects Java service to handle Desktop and Server deployment differently, without even using property files. – Vince Aug 23 '15 at 15:23
  • By simply having the output of the GP Service be of type "file", the service and the server framework return the URL to the client for them to download. You dont need to do any hacks inside the script and return a string path. – KHibma Aug 24 '15 at 13:19
2

I ended up doing the following:

The directory on the server is called "C:/arcgisserver/directories/arcgisoutput" so i simply created the same folder structure on my machine for the locale run.

The problem one will encounter when doing that is that arcgis changes your code when it publishes it, one of the changes being changing paths - so you have to trick arcgis into not realizing it is dealing with a path. I did this by splitting the path into two strings like so:

path = "C:/"+"arcgisserver/directories/arcgisoutput"

then when i published the path was left in its correct form.

The second problem is not really a problem if you put the file in the actual output folder, the url looks like so: http://:6080/arcgis/rest/directories/directory_name/file_name

read this link for more info http://resources.arcgis.com/EN/HELP/MAIN/10.1/index.html#/About_server_directories/0154000002w5000000/

  • Very helpful. Interesting hack on the paths. If you are trying to pass your paths as strings, try adding additional slashes for Python to recognize properly. 'C://arcgisserver//directories//arcgisoutput' – Jeremy Swagger Jan 16 '18 at 21:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.