In this example from the ArcGIS for Flex samples page: Clip and Ship

I am curious how from this function how the label property of each check box that is passed as input for the Layers_to_Clip parameter of the GPService are interpreted by the GPService as actual pieces of data.

private function getLayersToClip():Array
            var layersToClip:Array = [];

            if (incidentPointsCheckBox.selected)
            if (incidentLinesCheckBox.selected)
            if (incidentAreaCheckBox.selected)

            return layersToClip;

I have looked at the Clip and Ship data from the ArcTutor files and don't understand how the GPString values - which in this case are "Input Incident Points", "Input Incident Polylines", and "Input Incident Polygons" - correspond to any of the map layers.

Part 2) Ideally I would like to change my Flex application to take items selected from checkboxes and pass them into my model in the same fashion, except I won't be extracting them but using them in analysis. If preprocessing is done, every input would be a raster dataset regardless of the original geometry and the output would be a raster as well. How can I have those checkboxes refer to selected input rasters in a database location or within the map document/gp service?

Thanks in advance, I've been banging my head against the wall with this one,


1 Answer 1


So the function getLayersToClip creates and returns an array of string items. This array is returned to the calling line

var layersToClip:Array = getLayersToClip();

in the function createRequestObject

As the name suggestes this function is creating an object that will store all of the required inputs for the GP Service. This function returns an object of key:value pairs, one of which is the layersToClip array. This is defined in the line `

"Layers_to_Clip": layersToClip,` 

The other key value pairs are:

                "Area_of_Interest": areaOfInterestFeatures,
                "Feature_Format": downloadFormat

I'm guessing that each key corresponds to a required input of the GP Service and the value part will be the values actually passed, (you can see the required input names and the value type by looking at the rest endpoint: sampleserver4.arcgisonline.com/ArcGIS/rest/services/HomelandSecurity/Incident_Data_Extraction/GPServer/Extract%20Data%20Task).

Once the object with the required inputs has been created it is returned to the calling function extractData.

var requestObject:Object = createRequestObject();

This function stores the returned object as a variable called requestObject then calls the execute method on the GP service and passes the input parameter object as an argument



I'm not sure what you want to do with you list of rasters but the example above really just collects some text into an array. You could edit it to have an array of anything you want, be it raster names, locations of files on disk or even data streams. It will depend on what inputs you analysis model calls for. But for performance reasons I wouldn't pass raster objects directly, rather I would pass pointers to them.

  • Thanks for the explanation, but I knew I should have clarified my question and my knowledge of what is going on. I understand everything on the flex side of things, i.e. the whole process you explained. I understand that it is passing an array of string objects as one of the parameters to the GPService task. My question focuses more explicitly on how the GPService - based on the example ESRI provides - knows that the array of string objects passed through the REST request from gp.submitJob(requestObjects, ...) corresponds to the features/layers/etc of the GPService itself. Commented Sep 30, 2011 at 4:44
  • i.e. the String object "Input Incident Points" corresponds to a feature set, feature class, map layer, etc. that the model/script uses as input. Part two deals with the same thing, essentially asking if I can pass a string object to represent a point/polyline/polygon feature somewhere on the server can I not do the same for raster inputs? I also know about the restrictions on data types for inputs into a GPService. Do I need to use a string as detailed here: help.arcgis.com/en/arcgisserver/10.0/help/… Commented Sep 30, 2011 at 4:47
  • I think I made the connection. The examples are using different data; that particular GPService task does have as input variables named those string names: <br/> sampleserver4.arcgisonline.com/ArcGIS/rest/services/…> Once I have a chance to test this out tomorrow I will let you know if this was my issue, and will make a new question for accessing rasters if necessary. Thanks again. Commented Sep 30, 2011 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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