geospatialarcgisesriarcmaparcgis-server

ESRI GPDataFile as input Parameter to GP Toolbox


Im working with a PHP script that POSTs to a GPService Toolbox (written in python), the first parameter is supposed to be a GPDataFile. From the documentation, it looks like I can set the value of this parameter to a json formatted string literal, {"url", "http://localhost/export/1234567890.kml"}, and the arcpy.GetParameter(0) should handle this object correctly.

Unfortunately I am receiving an error, saying 'Please check your parameters', there are two other parameters on the toolbox but they are just strings and are working correctly. I am working in ArcGIS 10.0.

The overall goal of this interaction is to send a KML file from our SWF/ActionScript to the PHP, which saves the KML to our database and subsequently sends it to the GPService to translate it into a GDB and then to individual shapefile objects that are stored in the database for rendering back to the SWF/Actionscript.

Any help our thoughts on how to get the Toolbox to accept the JSON structure would be greatly appreciated, I would like to avoid having to send the KML contents as a string object to the Toolbox.


Solution

  • Answer can be what maniksundaram wrote in ESRI forum (https://community.esri.com/thread/107738):

    ArcGIS server will not support direct GPDataFile upload. You have to upload the file using upload task and give the item id for the GP service.

    Here is the high level idea to get it work for any GP service which needs file upload,

    -Publish the Geoprocessing service with upload option

    Refer : ArcGIS Help (10.2, 10.2.1, and 10.2.2)

    Operations allowed: Uploads: This capability controls whether a client can upload a file to your GIS server that the tasks within the geoprocessing service would eventually use. The upload operation is mainly used by web clients that need a way to send a file to the server for processing. The upload operation returns a unique ID for the file after the upload completes, which the web application could pass to the geoprocessing service. You may need to modify the maximum file size and timeouts depending on how large an upload you want your server to accept. Check the local REST SDK documentation installed on your ArcGIS Server machine for information on using an uploaded file with a geoprocessing service. This option is off by default. Allowing uploads to your service could possibly pose a security risk. Only turn this on if you need it.

    -Upload the file using the upload url that is generated in the geoprocessing service . It will give you the itemID of the uploaded file in response.

          http://<servername>:6080/arcgis/rest/services/GP/ConvertKMLToLayer/GPServer/uploads/upload
    

    Response Json:

    {"success":true,"item":{"itemID":"ie84b9b8a-5007-4337-8b6f-2477c79cde58","itemName":"SStation.csv","description":null,"date":1409942441508,"committed":true}}

    -Invoke the geoprocessing service with the item id as the GPDataFile input ,

     For Ex: KMLInput value would be  {"itemID":"ie84b9b8a-5007-4337-8b6f-2477c79cde58"}
    

    -The result will be added to map service with job id if you have configured the view the GP results in a map service. Or you can read the response as it returns.