GeoprocessingTask control


In this topic


About the GeoprocessingTask control

The GeoprocessingTask control utilizes resources in the GeoprocessingResourceManager to execute geoprocessing tasks. The control's interface is created dynamically at runtime based on the inputs required by the geoprocessing resource and task it uses. The results, which include input and output parameters, and progress messages are provided as an ADO.NET dataset to display in a TaskResults control. 
For information on geoprocessing input types and tool symbology support, see Geoprocessing input types and tool symbology

Using the control

  1. To use the GeoprocessingTask control, add supporting controls to the page. Set up a Web application with MapResourceManager, GeoprocessingResourceManager, and Map controls. Point the GeoprocessingResourceManager to an available ArcGIS Server-based geoprocessing resource, then add a TaskResults control. At runtime, the TaskResults control shows the results of the GeoprocessingTask. You can then interact with the results to change the map extent, display selected features, or re-execute the task. TaskResults also show a message when the task executes.

    The GeoprocessingResourceManager provides the information to the GeoprocessingTask control for creating the user interface (UI). The geoprocessing resource inputs and behavior are determined by how the model was constructed. For more information on creating and publishing geoprocessing models, see the ArcGIS Server Help system.

    To hide the geoprocessing input form when the application starts, and to allow you to access the form from a link on the page, add a Menu control from the standard ASP.NET Navigation tools, then add a TaskManager from the ArcGIS Web Controls toolbox. If you want to show the geoprocessing form immediately upon application startup, you can skip adding these controls.

    Be sure to set the BuddyControl property of the TaskManager to the previously added Menu control. Set the Map property of the TaskResults control to the previously added Map control, if you want to see results highlighted on the map when selected.
  2. To add a GeoprocessingTask control, in Visual Studio, open the prepared Web form in design mode, select the Toolbox panel, and expand the ArcGIS Web Controls tab. Drag and drop a GeoprocessingTask control into the TaskManager control (if you did not add a TaskManager control, drag the GeoprocessingTask onto the page). See the following screen shot that shows the layout arranged in a table format:


  3. To set the properties for the GeoprocessingTask control, in design mode, click the GeoprocessingTask, which shows the smart tag arrow in the upper-right of the control. Click the smart tag arrow to display the smart tag menu, which shows common properties that you can set; however, other properties are available in the Properties window for the control. See the following screen shot that shows the smart tag menu:


    1. Click Choose Task Results container on the smart tag menu or click the TaskResultsContainers property button on the Properties window. The BuddyControl Collection Editor dialog box appears. Click Add to add an item to the collection. Select the TaskResults1 item, then on the right side of the dialog box, click the drop-down list and select the previously added TaskResults control. This is where the GeoprocessingTask places results that are found when a query is executed. See the following screen shot that shows the BuddyControl Collection Editor dialog box:


    2. Click Choose Task Definition on the smart tag menu to select the task definition or click the TaskDefinition attribute button on the Properties window. The TaskDefinition Editor dialog box appears. On the dialog box, select the previously added GeoprocessingResourceManager. Select the geoprocessing resource from the Resource drop-down list, then select a task from the Task drop-down list. If no tasks are available, verify that the geoprocessing service contains at least one valid tool. See the following screen shot that shows the TaskDefinition Editor dialog box:


    3. If you added Menu and TaskManager controls, you can keep the query form from displaying at startup. Instead, the form displays when the user clicks the query link in the Menu control. To hide the query form at startup, select the QueryAttributesTask control, then on the Property window set the Visible property to false.
  4. By default, the GeoprocessingTask form appears in a floating window that can be dragged to a new position on the Web page. The opening position does not necessarily correspond to its position on the Web page design form. If preferred, the geoprocessing form window can be fixed at a specific position.
    1. To fix the position of the form at a specific location, set the position style of the GeoprocessingTask, or a containing control or DIV.
    2. To set the style, switch the Web page from design view to Hypertext Markup Language (HTML) view in Visual Studio. Find the GeoprocessingTask on the page listing. Insert a style attribute within the control tag, and set its position properties to specific values.
      • Use "position:absolute" to set the query form at an exact position on the page.
      • Use "position:relative" to fix the position relative to its placement to other controls.
The following code example shows relative placement to ensure the query window is placed in a table cell:
[HTML]
<td>
  <esriTasks:GeoprocessingTask style="position:relative;top:5px;left:0px;" 
    ID="GeoprocessingTask1" runat="server" ...>
  </esriTasks:GeoprocessingTask >
<td>
When fixing the position of the geoprocessing form window, you can set the CloseButton, Draggable, ExpandCollapseButton, HeightResizable, and WidthResizable properties to false to disallow modifying the query form. Setting Draggable to false disallows moving the form.
  1. The following describes additional properties for the GeoprocessingTask control that you can use to modify your application:
    • Title—Shows at the top of the geoprocessing form. Change the default, which is the ID of the control. Choose a title that describes the geoprocessing task's function, for example, Buffer points.
    • AsyncStatusCheckInterval—Interval in seconds at which the application checks for the task's execution status. Geoprocessing tasks run asynchronously; therefore, you can perform other operations in the Web application while the task executes. As the task executes, the Web application retrieves the results on the next interval's check. These results can contain data and information indicating the progress, and final results of the task and display when retrieved. You can adjust this property based on the expected time to execute the geoprocessing task. The default is 10 seconds.
    • FeatureSelectionColor—After task results display and the check box next to a feature is selected, the feature highlights with this color on the map.
    • ShowFieldAttributes—Whether to display feature attributes in the results for each feature.
  2. If TaskManager and Menu controls are used to bring up the geoprocessing task form, click the link for the geoprocessing task. The geoprocessing entry form appears. The number and format of form entry items depends on the design of the geoprocessing model.

    Enter required values on the form and click Submit. In this example, the user activates the add-point tool and clicks the map to add points, then sets the buffer distance before submitting the form. The results display as retrieved in the TaskResults control output. The following screen shot shows an example of a geoprocessing input form. The form varies considerably based on the model used.


Members

The following table shows a list of properties related to the GeoprocessingTask control. For more reference information, see the GeoprocessingTask control in the library reference section.
 
Property name
Type
Description
AsyncStatusCheckInterval
int
Interval in milliseconds between job status verification for asynchronous geoprocessing tasks.
DrawResultsOnMapServer
bool
Whether results can be drawn on a map server if the geoprocessing resource has an available map server.
FeatureSelectionColor
color
Color of selected features.
HideOnSubmit
bool
Whether to hide the task dialog box on submit.
ListOutputFeatures
bool
Whether the features of output layers are listed. Only applicable if features are drawn on the Web tier. If DrawResultsOnMapServer is set to true and a result map server is available, the drawn features are not listed under the output layer.
MaxFileUploadSize
int
Maximum file upload size in megabytes for the GPDataFile parameter support and for uploading result information for asynchronous tasks.
NavigationPath
string
Path to the task as it appears in a hierarchical data control buddied to the task's TaskManager.
ShowFieldAttributes
bool
Whether the results of this task have the field attributes.
ShowLegend
bool
Whether the results of this task have a legend. Legend is only available if GroupResultsByTable is set to true.
TaskDefinition
string
Task in the geoprocessing resource that this control works with.
TaskResultsContainers
BuddyControlCollection
Controls in which results from this task display.
VirtualDirectory
string
Relative path to the virtual directory in which files can be written, for example, /arcgisoutput.


See Also:

Geoprocessing input types and tool symbology
Web ADF controls




To use the code in this topic, reference the following assemblies in your Visual Studio project. In the code files, you will need using (C#) or Imports (VB .NET) directives for the corresponding namespaces (given in parenthesis below if different from the assembly name):
  • ESRI.ArcGIS.ADF.Tasks.dll