Uploading and using data to a geoprocessing service

15333
27
12-19-2012 07:32 PM
TomSchuller
Occasional Contributor III
Hy,
I'm trying to build a simple geoprocessing service which should buffer an uploaded shapefile.


This is the scenario:
  1) uploading shapefile to geoprocessing service
  2) buffering the shapefile with a given parameter
  3) returning the buffered shapefile
 
The buffering is not the problem, but the handling of the upload and reusing it in the model or python part.
As far as I read, I should have to use a Datafile parameter for upload, but I'm always getting this error while running it:
ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: input: Value is required Failed to execute


Can anybody help me to use uploads on geoprocessing services?


Thanks,
Tom
0 Kudos
27 Replies
KevinHibma
Esri Regular Contributor
Upload to a GP Service is sort of a multistep process.

You're correct, you do want to use a "file" (GPDataFile) as the input parameter.
If you're using Destkop to consume the service, desktop will send the file to the server.
If you're using a webapp, you're responsible for getting the file to the server. (Server at 10.1 has some upload capabilities in REST you can leverage. If using 10.0 or prior you'll need to devise a way to get the file to the server your self)

Once the file has been upload, because you're talking shape file, you'll have to unzip it. (shapefile being multiple files to make up a single one).
With it unzipped, you can then pass the file to your service.

Based on your error - your file didnt upload, or you never sent it. Whats the client to consume the GP Service - a web app?
0 Kudos
TomSchuller
Occasional Contributor III
thanks for the quick answer.
Yes, I know it's a multistep process.

I have the problem that I don't see howto handle an uploaded file over gpservice in a model or python script.
Did you have an example of your "unzipModel" scenario, like:
user is uploading data to gpservice (10.1 upload capabilities in rest)
user is calling the unzipModel with the upload-id as parameter (over rest url)
    the model is unzipping the zip file into some directory

I just need to see how I can use the uploaded file in a python script or model directly.


Thanks,
Tom
0 Kudos
TomSchuller
Occasional Contributor III
thanks for the quick answer.
Yes, I know it's a multistep process.

I have the problem that I don't see howto handle an uploaded file over gpservice in a model or python script.
Did you have an example of your "unzipModel" scenario, like:
user is uploading data to gpservice (10.1 upload capabilities in rest)
user is calling the unzipModel with the upload-id as parameter (over rest url)
     the model is unzipping the zip file into some directory

I just need to see how I can reuse the uploaded file in a python script or model directly.

Thanks,
Tom
0 Kudos
LaurynasGedminas
New Contributor
Hello,
Having the similar issue here, I created python script to upload text files to SDE,
published the script as GP service and it works in ArcMap and ArcGISExplorer.
In Flexviewer added this GP service with input parameter as "datafile" and i cant upload the files

Thanks,

Laurynas
0 Kudos
TomSchuller
Occasional Contributor III
Hy,
I didn't yet used it in the FlexViewer but only manually over rest.

But it should point you to the right direction:
  enable "upload" on your geoprocessing service
  upload your file to the gp-service and remember the upload-id
  call your gp-service with the datafile paramater as the text below:

For GPDatafile parameter, you have to indicate this full json representation of the upload item:
parameter = {"itemID":"i80dfa12f-52ed-4841-94ff-37f9c3f5dd6f"}

Tom
LaurynasGedminas
New Contributor
Thanks Tom,
I guess I was not clear about my problem
i dont know why flexviewer doesnt display "upload" button on its widget when input data type is set to "datafile"

Laurynas
0 Kudos
BjornSvensson
Esri Regular Contributor
If ESRI will update the geoprocessing widget so it will take a local file,  I, and many other users will be very happy!


Thanks for the suggestion to support local file uploads in the Geoprocessor widget.  We will take a look at this for version 3.2 of the Flex Viewer.  It would most likely just follow the steps outlined by Dasa in the thread you listed: http://forums.arcgis.com/threads/64114-Uploads-capability-on-Geoprocessor.

As for the ArcGIS API for Flex - since the Flash API already supports file upload, I don't think this is something we would add to the ArcGIS API for Flex.
0 Kudos
meriyalootka
New Contributor III
Hy
I have a model for uploading datafile, every thing is ok and user's zip file extract correctly. But I can not use extracted shapefile. Is there any py code for using feature class in a scratchfolder? Can I have this part of your model?

Hy,
I'm trying to build a simple geoprocessing service which should buffer an uploaded shapefile.


This is the scenario:
  1) uploading shapefile to geoprocessing service
  2) buffering the shapefile with a given parameter
  3) returning the buffered shapefile
 
The buffering is not the problem, but the handling of the upload and reusing it in the model or python part.
As far as I read, I should have to use a Datafile parameter for upload, but I'm always getting this error while running it:
ExecuteError: Failed to execute. Parameters are not valid. ERROR 000735: input: Value is required Failed to execute


Can anybody help me to use uploads on geoprocessing services?


Thanks,
Tom
0 Kudos
meriyalootka
New Contributor III
Hy
I have a model for uploading datafile, every thing is ok and user's zip file extract correctly. But I can not use extracted shapefile. Is there any py code for using feature class in a scratchfolder? Can I have this part of your model?



The datafile parameter input for the geoprocessing widget in the Viewer for Flex does not allow the user to upload a file to the server from their local machine.  It only accepts paths that begin with http:// or https://

I was under the impression that this was going to be fixed at the 3.1 release, but the widget still won't accept a local file.

This thread indicates all the pieces are available if you have the capability of creating your own custom widget:

http://forums.arcgis.com/threads/64114-Uploads-capability-on-Geoprocessor

There are many of us that cannot create custom widgets.  If ESRI will update the geoprocessing widget so it will take a local file,  I, and many other users will be very happy!

http://forums.arcgis.com/threads/54441-Uploading-to-SDE-from-Flex-Viewer
http://forums.arcgis.com/threads/41089-datafile-input-broken-in-Geoprocessing-widget
http://forums.arcgis.com/threads/36560-Geoprocessing-widget-has-me-stumped
http://forums.arcgis.com/threads/60510-Geoprocessing-with-File-Input
0 Kudos