GeoprocessingTask Class

  • GeoprocessingTask
  • class Esri::ArcGISRuntime::GeoprocessingTask

    GeoprocessingTask is used to run a geoprocessing task that is published as a web service. More...

    Header: #include <GeoprocessingTask.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::Object, Esri::ArcGISRuntime::Loadable, and Esri::ArcGISRuntime::RemoteResource

    Public Functions

    GeoprocessingTask(const QUrl &url, QObject *parent = nullptr)
    GeoprocessingTask(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)
    virtual ~GeoprocessingTask() override
    QFuture<Esri::ArcGISRuntime::GeoprocessingParameters> createDefaultParametersAsync()
    Esri::ArcGISRuntime::GeoprocessingJob *createJob(const Esri::ArcGISRuntime::GeoprocessingParameters &parameters)
    Esri::ArcGISRuntime::GeoprocessingTaskInfo geoprocessingTaskInfo() const

    Reimplemented Public Functions

    virtual void cancelLoad() override
    virtual Esri::ArcGISRuntime::Credential *credential() const override
    virtual void load() override
    virtual Esri::ArcGISRuntime::Error loadError() const override
    virtual Esri::ArcGISRuntime::LoadStatus loadStatus() const override
    virtual Esri::ArcGISRuntime::RequestConfiguration requestConfiguration() const override
    virtual void retryLoad() override
    virtual void setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration) override
    virtual QUrl url() const override

    Signals

    void doneLoading(const Esri::ArcGISRuntime::Error &loadError)
    void loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Detailed Description

    GeoprocessingTask is the main component when running geoprocessing tasks. The task can be published through ArcGIS Server, or through Local Server on the platforms that support it, using either synchronous execute or asynchronous submit execution type. When GeoprocessingParameters is created to pass into createJob, it is important to match its executionType to the value on the service.

    This is the general workflow of using a geoprocessing task:

    1. Create a GeoprocessingTask using the full URL to the target geoprocessing task endpoint.
    2. Create a GeoprocessingParameters providing corresponding GeoprocessingExecutionType.
    3. Create the necessary GeoprocessingParameters and add them to GeoprocessingParameters::inputs, where key is the name of the parameter and value is created parameter.
    4. Set environmental variables on GeoprocessingParameters if needed, such as GeoprocessingParameters::isReturnZ or GeoprocessingParameters::outputSpatialReference.
    5. Create a GeoprocessingJob with createJob.
    6. Start listening for status and message changes using the GeoprocessingJob::statusChanged signal.
    7. Run targeted geoprocessing tool using GeoprocessingJob::start which sets GeoprocessingResult when finished.
    8. Handle returned values accordingly. Access output parameters through GeoprocessingResult::outputs QMap where key is the name of the output parameter and the value is returned parameter. If used geoprocessing service is configured to use result map service, GeoprocessingResult::mapImageLayer might be created for you.

    Relevant samples:

    • Analyze hotspots: Use a geoprocessing service and a set of features to identify statistically significant hot spots and cold spots.
    • Local server geoprocessing: Create contour lines from local raster data using a local geoprocessing package `.gpkx` and the contour geoprocessing tool.
    • Viewshed (Geoprocessing): Calculate a viewshed using a geoprocessing service, in this case showing which parts of a landscape are visible from points on mountainous terrain.

    See also GeoprocessingTask(const QUrl&, QObject*).

    Member Function Documentation

    [explicit] GeoprocessingTask::GeoprocessingTask(const QUrl &url, QObject *parent = nullptr)

    Creates a geoprocessing task from a URL for a task within an ArcGIS REST geoprocessing service.

    • url - The URL of a task within an ArcGIS REST geoprocessing service.
    • parent - The optional parent QObject.

    [since Esri::ArcGISRuntime 100.1] GeoprocessingTask::GeoprocessingTask(const QUrl &url, Esri::ArcGISRuntime::Credential *credential, QObject *parent = nullptr)

    Constructor that accepts a URL (url), credential and an optional parent.

    • url - The URL of the Geoprocessing service.
    • credential - The credential.
    • parent - The parent object for this GeoprocessingTask (optional).

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [override virtual] GeoprocessingTask::~GeoprocessingTask()

    Destructor.

    [override virtual, since Esri::ArcGISRuntime 100.1] void GeoprocessingTask::cancelLoad()

    Reimplements: Loadable::cancelLoad().

    Cancels loading metadata for the object.

    Cancels loading the metadata if the object is loading.

    See Loadable.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [since Esri::ArcGISRuntime 200.2] QFuture<Esri::ArcGISRuntime::GeoprocessingParameters> GeoprocessingTask::createDefaultParametersAsync()

    Default parameters for a geoprocessing task.

    This will populate the parameters with default values for all of the input parameters defined by the service. If the service defines a default value for a parameter, this will be used. If no default value is defined for a parameter, it will be given an appropriate default for its type: boolean parameters false, string parameters an empty string, numerical parameters 0. The correct execution type for this task will also be set.

    This method returns a QFuture for the asynchronous operation. Use future.then() to continue processing when the operation completes. Use future.onFailed() to handle exceptions of type ErrorException.

    See Working with QFuture for further details.

    This function was introduced in Esri::ArcGISRuntime 200.2.

    Esri::ArcGISRuntime::GeoprocessingJob *GeoprocessingTask::createJob(const Esri::ArcGISRuntime::GeoprocessingParameters &parameters)

    Returns a job that when started will run a geoprocessing job on the server.

    • parameters - The parameters for submitting the geoprocessing job.

    [override virtual, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Credential *GeoprocessingTask::credential() const

    Reimplements: RemoteResource::credential() const.

    Returns the security credential used to access this GeoprocessingTask.

    Only applicable if the service is secured.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [signal, since Esri::ArcGISRuntime 100.1] void GeoprocessingTask::doneLoading(const Esri::ArcGISRuntime::Error &loadError)

    Signal emitted when this object is done loading.

    • loadError - Details about any error that may have occurred.

    Note: If there is a load error it will also be emitted on the errorOccurred signal.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also Loadable and Object.

    [since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::GeoprocessingTaskInfo GeoprocessingTask::geoprocessingTaskInfo() const

    Returns the GeoprocessingTaskInfo about the GeoprocessingTask.

    Wait until the GeoprocessingTask is doneLoading before attempting to obtain the GeoprocessingTaskInfo.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [override virtual, since Esri::ArcGISRuntime 100.1] void GeoprocessingTask::load()

    Reimplements: Loadable::load().

    Loads the metadata for the object asynchronously.

    Loads the metadata if the object is not loaded.

    See Loadable.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [override virtual, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::Error GeoprocessingTask::loadError() const

    Reimplements: Loadable::loadError() const.

    Returns the load error.

    See Loadable.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also Error.

    [override virtual, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::LoadStatus GeoprocessingTask::loadStatus() const

    Reimplements: Loadable::loadStatus() const.

    Returns the load status.

    See Loadable.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also LoadStatus.

    [signal, since Esri::ArcGISRuntime 100.1] void GeoprocessingTask::loadStatusChanged(Esri::ArcGISRuntime::LoadStatus loadStatus)

    Signal emitted when the load status changes for this object.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also Loadable.

    [override virtual, since Esri::ArcGISRuntime 100.1] Esri::ArcGISRuntime::RequestConfiguration GeoprocessingTask::requestConfiguration() const

    Reimplements: RemoteResource::requestConfiguration() const.

    Returns the RequestConfiguration in use by this task.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also setRequestConfiguration().

    [override virtual, since Esri::ArcGISRuntime 100.1] void GeoprocessingTask::retryLoad()

    Reimplements: Loadable::retryLoad().

    Loads or retries loading metadata for the object asynchronously.

    Will retry loading the metadata if the object is failed to load. Will load the object if it is not loaded. Will not retry to load the object if the object is loaded. Will always call the done loading if this is called.

    See Loadable.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    [override virtual, since Esri::ArcGISRuntime 100.1] void GeoprocessingTask::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration)

    Reimplements: RemoteResource::setRequestConfiguration(const Esri::ArcGISRuntime::RequestConfiguration &requestConfiguration).

    Sets configuration parameters used for network requests sent by this task to requestConfiguration.

    This function was introduced in Esri::ArcGISRuntime 100.1.

    See also requestConfiguration().

    [override virtual] QUrl GeoprocessingTask::url() const

    Reimplements: RemoteResource::url() const.

    Returns the URL of this GeoprocessingTask.

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.