Geoprocessor Activity How-To
We have had lots of requests from users looking to bring Esri geoprocessing tasks into their workflows. As of Essentials 3.5 it is now possible to do this with the “Geoprocessor” activity. How you would actually go about implementing a workflow with a GP task may not be entirely obvious so we’ve put together a short video that goes through the whole process (http://vimeo.com/geocortex/review/32098681/061ca79099) .
The workflow Xaml files used in the video are available here (http://support.geocortex.com/Data/Sites/1/userfiles/1725/messageinabottle.zip) messageinabottle.zip .
--Ryan
-
Thanks Ryan,
Nice demonstration
What I am looking for now is a standard geocortex way to transfer and show any attributes a GP model is outputing along the GPfeatureResultSet (e.g. Driving time for a network analyst Closest facilities analysis). I was wondering if I can submit that to a listbox in a Workflow Form or by any other mean, and how?
Thanks
0 -
Hi Sune,
To display a list of GP results in a Form (in a ListBox) you will first need to convert your results into a List<DataItem>. You'll probably need to set up a ForEach loop that goes though each result from your GP task, creates a DataItem using the desired attributes, and then adds it to a list. You can then pass the list to a DisplayForm as the input to your ListBox. I hope this helps.
--Ryan
0 -
Hi Ryan
I note that the geoprocessing task in the video has a Synchronous Execution Type.
The geoprocessing task that I have is set up to be Asynchronous and can be found here:
http://geo.rdc.govt.nz/arcgis/rest/services/BOPLASS/DataDownload/GPServer/DataDownload
The issue that I have is that my workflow that makes use of the Geoprocessing task is not recogising that it should be Asynchronous.
I do not want my workflow to wait around for the SL Client to wait around for the Geoprocessing task to complete as there is e-mailing functionality etc in the Geoprocessing Task on AGS Server.
Unfortunately it does wait around for the completion of the Geoprocessing Task.
Here is a sample workflow:
<Activity mc:Ignorable="sap sads" x:Class="{x:Null}" sap:VirtualizedContainerService.HintSize="492,678" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces"
xmlns="http://schemas.microsoft.com/netfx/2009/xaml/activities"
xmlns:eac="clr-namespace:ESRI.ArcGIS.Client;assembly=ESRI.ArcGIS.Client"
xmlns:eacg="clr-namespace:ESRI.ArcGIS.Client.Geometry;assembly=ESRI.ArcGIS.Client"
xmlns:eact="clr-namespace:ESRI.ArcGIS.Client.Tasks;assembly=ESRI.ArcGIS.Client"
xmlns:esri="http://schemas.esri.com/arcgis/client/2009"
xmlns:gce="clr-namespace:Geocortex.Core.Extensions;assembly=Geocortex.Core"
xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi"
xmlns:gfci="clr-namespace:Geocortex.Forms.Client.Items;assembly=Geocortex.EssentialsWpfApi"
xmlns:gr="clr-namespace:Geocortex.Reporting;assembly=Geocortex.Reporting"
xmlns:gwa="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow"
xmlns:gwa1="clr-namespace:Geocortex.Workflow.Activities;assembly=Geocortex.Workflow.Activities"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities"
xmlns:s="clr-namespace:System;assembly=System.Core"
xmlns:s1="clr-namespace:System;assembly=System"
xmlns:s2="clr-namespace:System;assembly=mscorlib"
xmlns:s3="clr-namespace:System;assembly=System.Reactive.Core"
xmlns:s4="clr-namespace:System;assembly=System.ComponentModel.Composition"
xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities"
xmlns:sads="http://schemas.microsoft.com/netfx/2010/xaml/activities/debugger"
xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation"
xmlns:scg="clr-namespace:System.Collections.Generic;assembly=mscorlib"
xmlns:sl="clr-namespace:System.Linq;assembly=System.Core"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Sequence sap:VirtualizedContainerService.HintSize="452,598" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">
<Sequence.Variables>
<Variable x:TypeArguments="x:String" Name="string1" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<gwa1:Alert sap:VirtualizedContainerService.HintSize="430,82" Text="Starting..." />
<Sequence DisplayName="seqStartGeoProcessing" sap:VirtualizedContainerService.HintSize="430,230">
<Sequence.Variables>
<Variable x:TypeArguments="esri:GPString" Name="gPString1" />
</Sequence.Variables>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
<gwa1:Geoprocessor DisplayName="SendClipShipZipRequest" GeoprocessorUrl="http://geo.rdc.govt.nz/arcgis/rest/services/BOPLASS/DataDownload/GPServer/DataDownload" sap:VirtualizedContainerService.HintSize="408,106" IsAsynchronous="True" JobId="[string1]">
<gwa1:Geoprocessor.InArguments>
<gwa:GPArgumentWrapper x:TypeArguments="InArgument" DataType="GPLong" DisplayName="RequestID" GPParameterType="esri:GPLong" IsRequired="True" Name="RequestID">
<gwa:GPArgumentWrapper.Argument>
<InArgument x:TypeArguments="esri:GPLong">[New GPLong("RequestID", 8832)]</InArgument>
</gwa:GPArgumentWrapper.Argument>
</gwa:GPArgumentWrapper>
</gwa1:Geoprocessor.InArguments>
<gwa1:Geoprocessor.OutArguments>
<gwa:GPArgumentWrapper x:TypeArguments="OutArgument" DataType="GPString" DisplayName="theResult" GPParameterType="esri:GPString" IsRequired="False" Name="theResult">
<gwa:GPArgumentWrapper.Argument>
<OutArgument x:TypeArguments="esri:GPParameter" />
</gwa:GPArgumentWrapper.Argument>
</gwa:GPArgumentWrapper>
</gwa1:Geoprocessor.OutArguments>
<sap:WorkflowViewStateService.ViewState>
<scg:Dictionary x:TypeArguments="x:String, x:Object">
<x:Boolean x:Key="IsExpanded">True</x:Boolean>
</scg:Dictionary>
</sap:WorkflowViewStateService.ViewState>
</gwa1:Geoprocessor>
</Sequence>
<gwa1:Alert sap:VirtualizedContainerService.HintSize="430,82" Text="Finished" Title="[string1]" />
</Sequence>
</Activity>With the RequestID of 8832 it takes around 306 seconds to run which is obviously unacceptable for a user to stare at the screen for.
Is there something that I have missed in the configuration of the Geoprocessor Activity to deal with this situation?
I note that when I run the Workflow as seen above in the Simulator a Geocortex.Workflow.Activities.ExternalDelay Activity occurs that uses a default value of 1000 milliseconds.
I hoped thought that it was possible to avoid this ExternalDelay Activity by setting the Update Delay on the Geoprocessor Activity to be -1 but that did not improve the situation.
If I check the Wait On Server option then it is entirely blocked on progress until the geoprocessing task has been completed.
Regards
Ralph
PS this is using GE 3.15 and SL 1.10
0 -
Hi Ralph,
It sounds like what you are after is to have your workflow initiate the Geoprocessor activity, but not wait around for it to complete. The Geoprocessor activity doesn't support this itself, but we built a general purpose activity to do this called "Invoke Workflow Async".
Invoke Workflow Async allows one workflow to initiate another workflow as a background process. You'd put your Geoprocessor activity in the child workflow and pass any parameters to it as input arguments on the child workflow. You'll also need to make sure that the Geoprocessor's "Wait On Server" property is set to True.
Have a look at the help documentation for the Invoke Workflow Async activity for more details.
--Ryan
0 -
Hi Ben,
This should be possible. And everything looks correct with your workflow. When I try to run it I see this request in Fiddler as the workflow attempts to submit the GP Task:
(http://hqcvgisdev01.fesa.wa.gov.au/HQCVGISDEV01/rest/services/ConvertGPSFile2SHP/GPServer/Convert%20GPX%20to%20SHP/submitJob?GPX_File=%7b%22url%22%3a%22http%3a%2f%2fHQCVGISDEV01.fesa.wa.gov.au%2fGeocortex%2fEssentials%2fREST%2fTempFiles%2finvalid.gpx%3fguid%3d3ec2ce72-cbac-469c-a9ec-f53871ff99a5%26contentType%3dtext%252Fgpx%22%7d&Feature_Type=POLYLINE&f=json&_ts=635163861632361737) http://hqcvgisdev01.fesa.wa.gov.au/HQCVGISDEV01/rest/services/ConvertGPSFile2SHP/GPServer/Convert%20GPX%20to%20SHP/submitJob?GPX_File=%7b%22url%22%3a%22http%3a%2f%2fHQCVGISDEV01.fesa.wa.gov.au%2fGeocortex%2fEssentials%2fREST%2fTempFiles%2fmyFile.gpx%3fguid%3d3ec2ce72-cbac-469c-a9ec-f53871ff99a5%26contentType%3dtext%252Fgpx%22%7d&Feature_Type=POLYLINE&f=json&_ts=635163861632361737
This host isn't accessible to me, but it appears to be a valid request. I suspect that it must be failing for one of two reasons:
- It can't reach (http://hqcvgisdev01.fesa.wa.gov.au/HQCVGISDEV01/rest/services/ConvertGPSFile2SHP/GPServer/Convert%20GPX%20to%20SHP/submitJob?GPX_File=%7b%22url%22%3a%22http%3a%2f%2fHQCVGISDEV01.fesa.wa.gov.au%2fGeocortex%2fEssentials%2fREST%2fTempFiles%2finvalid.gpx%3fguid%3d3ec2ce72-cbac-469c-a9ec-f53871ff99a5%26contentType%3dtext%252Fgpx%22%7d&Feature_Type=POLYLINE&f=json&_ts=635163861632361737) http://hqcvgisdev01.fesa.wa.gov.au/HQCVGISDEV01/rest/services/ConvertGPSFile2SHP/GPServer/Convert%20GPX%20to%20SHP/submitJob (this is probably not the case).
- It can make the request but when the GP Task attempts to download the data file from the temp file URL it is unable to.
I'd suggest that you try to run the GP Task directly from the ArcGIS Server REST endpoint and see how a sucessful request compares to this.
--Ryan
0 -
Hi Ben,
It sounds like you're almost there, but you may still find the following code-gallery sample helpful:
https://support.geocortex.com/gpx-to-features
-Victoria
0 -
Ben,
To clarify, you should only need to give your Essentials user access to the folder that is accessed by the WriteFile workflow activity.
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
7 Kommentare