ArcGIS Runtime SDK for WPF - Library Reference
LocalGeoprocessingService Class
Members  Example  See Also 
ESRI.ArcGIS.Client.Local Namespace : LocalGeoprocessingService Class

A class representing a local geoprocessing service hosted by the runtime local server.

Object Model

LocalGeoprocessingService Class


Visual Basic (Declaration) 
Public NotInheritable Class LocalGeoprocessingService 
   Inherits LocalService
public sealed class LocalGeoprocessingService : LocalService 


A single local geoprocessing service instance corresponds directly to a geoprocessing package shared from ArcGIS for Desktop. One or more geoprocessing tasks may be exposed by the local geoprocessing service depending on the number of individual tool or script results contained within the geoprocessing package. When starting local geoprocessing services there are a number of properties you must choose values for which are usually determined by the server administrator for online geoprocessing services hosted by ArcGIS for Server.

These properties are: Service execution type: The ServiceType property determines whether the service will run the task asynchronously or synchronously. This affects how the client application you are developing interacts with the runtime local server and gets the result from the task. When a service is set to Execute (synchronous) operation, the client waits for the task to finish. Typically, a service that will run tasks synchronously should execute quickly (five seconds or less). A service should be set to use the SubmitJob (asynchronous) if one or more of that tasks within that service will takes longer to run. When using the SubmitJob mode the client application must periodically ask the server if the task has finished and, if it has finished, get the result. The API can perform this periodic check for you on a frequency determined by the Geoprocessor task UpdateDelay property, the default value being 1000 milliseconds. The GPServiceType enumeration values which determine the synchronous or asynchronous service operation are called "Execute" and "SubmitJob" to align them with the corresponding methods on the Geoprocessor task API and to differentiate them from the synchronous or asynchronous usage of those methods: Geoprocessor.ExecuteAsync, Geoprocessor.Execute, Geoprocessor.SubmitJobAsync and Geoprocessor.SubmitJob. You must use the method which corresponds to the GPServiceType of the local geoprocessing service you are working with. The service mode SubmitJobWithMapServerResult will enable you to display the results of the task within a local map service. Maximum number of records returned: The maximum number of results the service can return to a client. Setting this value to a large number means your runtime local server can handle sending a lot of individual records or features to the client application. Whether you choose this pattern depends on the number and complexity of the feature geometries. To display large numbers of graphic features you should consider using the accelerated display mode enabled via ESRI.ArcGIS.Client.Map.UseAcceleratedDisplay property or the ESRI.ArcGIS.Client.AcceleratedDisplayLayers group layer. If you do not want to return any features, set this value to 0 (zero). Typically, you set this value to zero only when you create the service as SubmitJobWithMapServerResult. To determine whether the MaxRecords limits has been exceeded you should check the exceeded transfer limit property of the feature set or record set returned by the task. The exceeded transfer limit property will be set to true when the number of records and features of the output parameter exceed the maximum number of records specified by the service. this information is also included in the GPMessages returned by the service.

Once you have created a new LocalGeoprocessingService and specified the Path, ServiceType and MaxRecords properties, starting the service via the StartAsync or Start methods will populate the UrlGeoprocessingService property. It is this last property, the URL of the local geoprocessing service that you provide a ESRI.ArcGIS.Client.Tasks.Geoprocessor task with in order to interact with the tasks exposed by the service. Additionally you can use the static GetServiceAsync(String,GPServiceType,Action<LocalGeoprocessingService>) and GetService(String,GPServiceType) methods to instantiate and start a new local geoprocessing service or alternatively the task extension methods InitializeWithLocalServiceAsync and InitializeWithLocalService.


This example shows how to create a new LocalGeoprocessingService and use the first task within that service to provide the Url property for the Geoprocessor task:
C#Copy Code
// Create a new LocalGeoprocessing service of synchronous execution type.
LocalGeoprocessingService gpService
    = new LocalGeoprocessingService("Path to geoprocessing package", GPServiceType.Execute, 1000000);
gpService.StartAsync(delegateService =>
        // Instantiate a new Geoprocessor task with the Url.
        ESRI.ArcGIS.Client.Tasks.Geoprocessor geoprocessorTask
            = new ESRI.ArcGIS.Client.Tasks.Geoprocessor(gpService.Tasks[0].Url);
VB.NETCopy Code
' Create a new LocalGeoprocessing service of synchronous execution type.
Dim gpService As New LocalGeoprocessingService("Path to geoprocessing package", GPServiceType.Execute, 100000)
    ' Instantiate a new Geoprocessor task with the Url.
    Dim geoprocessorTask As New ESRI.ArcGIS.Client.Tasks.Geoprocessor(gpService.Tasks(0).Url)
End Function)

Inheritance Hierarchy



Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8

See Also

© ESRI, Inc. All Rights Reserved.