Hoppa till huvudinnehållet

Getting a simple buffer workflow to work

Kommentarer

5 kommentarer

  • Permanently deleted user

    Tjibbe,

    I have an app that requires a similar tool, so I tried your workflow.  I set it up as a button in the toolbar and I set it up as a tool in the toolbar. Neither work.  How do you access it in your application?

    You said it doesn't get to the buffer task - "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/buffer"

    Do you have a geometry service on your server that you could try? 

    I see a problem with the second RunExternalCommand.  It is set to send a ESRI.ArcGIS.Client.Graphic argument to the AddMarkup.  That might be a problem.

    On page 66 of the 1.2 Silverlight Admin Guide, you can get a list of commands that can be used by RunExternalCommand

    AddMarkup  - Adds the given geometry to the markup layer.

     

    Argument:  ESRI.ArcGIS.Client.Geometry.Geometry

    Sonia

    0
  • Permanently deleted user

    Sonia,

    Thank you for your quick reply! In my initial try I referred to a geometry service on one of our own GISservers. That didn't work. I changed it to the ESRI sampleserver before sending it in to this forum so it should work for everyone. Now I just changed it back to our own server and I do get to the second prompt. It gives the result:

    System.Collections.Generic.List`1[ESRI.ArcGIS.Client.Graphic]

    So I understand it's a collection of ESRI graphics. I do know that the addmarkup comment only allows geometries as an input. However, I don't know how to get to a geometry from that graphic. I understand the buffergeometry task results in an esri geometry. But this is not what I'm trying to do. What I'm trying to do is see if I can get a ESRI geometry tool to work.

    Tjibbe

    0
  • Permanently deleted user

    Sonia,

    I figured it out in the end. First problem was that my collected geometry (point clicked on the map) did not have a spatial reference connected to it. So I set that with an assign statement. Next problem was that my buffer task did not have an out spatial reference defined. So I also set this one. The next problem was that the output of the buffer task is a enumeration of ESRI graphics and I need geometries to add them to markup. So I changed the parameter in RunExternalCommand to bufferResult.first().Geometry. First this gave an error. I then figured out I had to import the library first (enter the value System.Linq in the imports screen (bottom screen next to variables and arguments)). Hooray, this should work! But sadly it didn't. Then I found in the Workflow Designer simulator the error "The calling thread cannot access this object because a different thread owns it.". This I could find in the forum here, it said: "Unfortunately it has recently come to light that accessing the results variable of a Buffer Task can crash workflow. If the access occurs at the end of your workflow then the task ?will still complete even though it throws an error in the simulator. However, no subsequent tasks will complete. In some cases you can get around this problem by placing tasks in parallel (look for the 'Parallel' item in 'Control Flow'). Only the execution path where the buffer task result is accessed will terminate, the others will still continue". So I made the buffer and the addmarkup parallel processes and it works perfectly.

    This is the resulting workflow:

    <Activity mc:Ignorable="sap" x:Class="{x:Null}" sap:VirtualizedContainerService.HintSize="835,1130" 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:gc="clr-namespace:Geocortex.Core;assembly=Geocortex.Core" xmlns:gfc="clr-namespace:Geocortex.Forms.Client;assembly=Geocortex.EssentialsWpfApi" xmlns:ggg="clr-namespace:Geocortex.Gis.Geometries;assembly=Geocortex.Gis" xmlns:ggs="clr-namespace:Geocortex.Gis.Services;assembly=Geocortex.Gis" 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" xmlns:s1="clr-namespace:System;assembly=mscorlib" xmlns:s2="clr-namespace:System;assembly=System.Core" xmlns:s3="clr-namespace:System;assembly=System.ServiceModel" xmlns:s4="clr-namespace:System;assembly=System.Web.Services" xmlns:sa="clr-namespace:System.Activities;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:sw="clr-namespace:System.Windows;assembly=WindowsBase" xmlns:sw1="clr-namespace:System.Windows;assembly=PresentationFramework" xmlns:sw2="clr-namespace:System.Windows;assembly=PresentationCore" xmlns:swt="clr-namespace:System.Windows.Threading;assembly=WindowsBase" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

     

      <Sequence sap:VirtualizedContainerService.HintSize="795,922" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">

     

        <Sequence.Variables>

     

          <Variable x:TypeArguments="esri:Geometry" Name="esripunt" />

     

          <Variable x:TypeArguments="scg1:IEnumerable(esri:Graphic)" Name="bufferResult" />

     

        </Sequence.Variables>

     

        <sap:WorkflowViewStateService.ViewState>

     

          <scg1:Dictionary x:TypeArguments="x:String, x:Object">

     

            <x:Boolean x:Key="IsExpanded">True</x:Boolean>

     

          </scg1:Dictionary>

     

        </sap:WorkflowViewStateService.ViewState>

     

        <gwa1:CaptureGeometry CaptureType="[Geocortex.Workflow.Activities.GeometryCaptureType.MapPoint]" sap:VirtualizedContainerService.HintSize="773,82" Result="[esripunt]" />

     

        <Assign sap:VirtualizedContainerService.HintSize="773,57">

     

          <Assign.To>

     

            <OutArgument x:TypeArguments="esri:SpatialReference">[esripunt.spatialreference]</OutArgument>

     

          </Assign.To>

     

          <Assign.Value>

     

            <InArgument x:TypeArguments="esri:SpatialReference">[new esri.ArcGIS.Client.Geometry.SpatialReference(28992)]</InArgument>

     

          </Assign.Value>

     

        </Assign>

     

        <gwa1:Prompt DefaultText="[esripunt.tostring]" Description="Return Point as String" sap:VirtualizedContainerService.HintSize="773,128" Title="Prompt 1" />

     

        <gwa1:RunExternalCommand CommandName="AddMarkup" CommandParameter="[esripunt]" sap:VirtualizedContainerService.HintSize="773,82" />

     

        <Parallel sap:VirtualizedContainerService.HintSize="773,289">

     

          <gwa1:BufferTask Distance="1000" Geometry="[esripunt]" GeometryServiceUrl="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/buffer" sap:VirtualizedContainerService.HintSize="330,243" OutSpatialReference="[new esri.ArcGIS.Client.Geometry.SpatialReference(28992)]" Results="[bufferResult]" Unit="[ESRI.ArcGIS.Client.Tasks.LinearUnit.Meter]" />

     

          <gwa1:RunExternalCommand CommandName="AddMarkup" CommandParameter="[bufferResult.first().Geometry]" DisplayName="RunExternalCommand" sap:VirtualizedContainerService.HintSize="289,243" />

     

        </Parallel>

     

      </Sequence>

     

    </Activity>
    0
  • Permanently deleted user

    Sonia

     

     

    Where did you get the Admin Guide?  I am trying to find the list of command that can be run by the External Command!

     

     

    "On page 66 of the 1.2 Silverlight Admin Guide, you can get a list of commands that can be used by RunExternalCommand

     

    AddMarkup  - Adds the given geometry to the markup layer.

     

    Argument:  ESRI.ArcGIS.Client.Geometry.Geometry"

     

     

    Thanks

     

    Jen
    0
  • Permanently deleted user

    The Silverlight 1.2.1 Administrator Guide can be accessed via the downloads page:

    http://support.geocortex.com/downloads

    Specific link to the pdf is:

    http://support.geocortex.com/SharedFiles/Download.aspx?pageid=12&mid=14&fileid=229

     

    0

Du måste logga in om du vill lämna en kommentar.