Is there any QML API support for calling a geoprocessing service?

3741
17
Jump to solution
11-11-2015 11:03 PM
PaulHaakma
Regular Contributor

I can't find anything in the docs so thought it worth asking...

Is there any QML API support for calling a geoprocessing service?

Cheers

-Paul

0 Kudos
1 Solution

Accepted Solutions
GarethWalters
Occasional Contributor III

Hi Paul,

If there is nothing in Runtime that hooks in, then you could always get to it via the REST interface using the NetworkRequest component.

View solution in original post

0 Kudos
17 Replies
GarethWalters
Occasional Contributor III

Hi Paul,

If there is nothing in Runtime that hooks in, then you could always get to it via the REST interface using the NetworkRequest component.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Our Runtime QML API does not support GP yet. However, we plan to support it in our Quartz release, so until AppStudio is able to move to this, you will need to do what Gareth suggests and perform your own REST request.

RuthannL1
New Contributor

Hi, 

Is there an example that demonstrates a REST request for a geoprocessing service on a server?

Thanks,

Ruthann

0 Kudos
RaphaelWitt
New Contributor

Hi,

I am highly interested in this topic. So I ask again: Is there an example of a REST request for a GP service on a server?

That would help me a lot!

Greetings and thanks,

Raphael

0 Kudos
GarethWalters3
New Contributor III

Hi Raphael,

there is a sample in AppStudio called networkrequest. It will show an example of making rest calls to an arcgis server. You should be able to follow that and modify it to call a GP service.

cheers,

gareth

0 Kudos
RaphaelWitt
New Contributor

Hi Gareth,

thanks for your reply! I tried figuring out how I can call my GP service. I have read the entire docu but I have the following problem:

I want to call my GP service in the networkrequest sample, but how can I specify the input in QML? I tried to build the URL like the examples at ArcGIS REST API :

"http://sampleserver2.arcgisonline.com/ArcGIS/rest/services/PublicSafety/EMModels/GPServer/ERGByChemi...{ \"features\" : [{ \"geometry\" : {\"x\" : -104.44, \"y\" : 34.83}, \"attributes\" : {\"Id\" : 43, \"Name\" : \"Incident\"}}]} &Material_Type=&Wind_Bearing__direction_blowing_to__0_-_360_=&Day_or_Night_incident=&Large_or_Small_spill=&env:outSR=&env:processSR=&f=html"

I thought I need the "..." specified in my URL, but I get the following error message:

"NetworkRequest::setErrorText(const class QString &) "Protocol \"\" is unknown"

Is there another way to call my GP service with specified input?

Thank you in advance!!

Raphael

0 Kudos
jaykapalczynski
Frequent Contributor

Did you ever figure this out....

I have a GP Service running and I can input values and it works great...

I just cant figure out how to call that Service from AppStudio and pass it the input parameters.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Geoprocessing is now available in ArcGIS Runtime. You should be able to create a GeoprocessingTask by pointing to your service URL, create/modify parameters, and execute the task/job.

Here is the API ref doc - GeoprocessingTask QML Type | ArcGIS for Developers 

Here is some conceptual doc for GP in Runtime - Run a geoprocessing task—ArcGIS Runtime SDK for Qt | ArcGIS for Developers 

Here is a sample of using the GeoprocessingTask - arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_QMLSamples/Analysis/AnalyzeViewshed at master · Esri/ar... 

0 Kudos
jaykapalczynski
Frequent Contributor

THANK YOU FOR YOUR RESPONSE

I have been trying to use that sample for a bit now....new to this....I am simply trying to pass a few parameters to a GP service.  Not sure if I have to create a FeatureCollectionTable?

This does not work...but i know the GP service works because I can manually run it....I just cannot figure out how to pass the values 

Does anything stick out to you below.

Im stuck on #3 

Here is some conceptual doc for GP in Runtime - Run a geoprocessing task—ArcGIS Runtime SDK for Qt | ArcGIS for Developers

 

If I console.log viewshedParameters below there is nothing in the objects:{} in the object

 // ON BUTTON CLICK
  viewshedTask.calculateViewshed();



GeoprocessingTask {
    id: viewshedTask        
    url: "https://xxxx/arcgis/rest/services/x/x/GPServer/NewScriptToRun"

    function calculateViewshed() {

         var paramsvalue = {'OBJECTID':ObjectID,'comments':Comments};

         var viewshedParameters = ArcGISRuntimeEnvironment.createObject("GeoprocessingParameters",
  {executionType:Enums.GeoprocessingExecutionTypeSynchronousExecute,objectName:"Parameter Name",inputs:paramsvalue });


         viewshedJob = viewshedTask.createJob(viewshedParameters);

         viewshedJob.start();

    }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

import arcpy
from arcpy import env
import os

# Geting user input for project name, status, type, submital date and planner name  
varObjectID = arcpy.GetParameterAsText(0) 
varItem = arcpy.GetParameterAsText(1)  ‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos