Skip to main content

In a workflow, how do I get all features "inside" of an existing polygon feature selected?

Comments

15 comments

  • Nico Burgerhart
    How is the buffer created/set?
    0
  • Jill Ryan
    [We are using GeoCortex WF Designer Version 4.6.3.24]

     

    I am new to workflows, so let me know if this is not the answer you are looking for... 

     

    Using the BufferTask (on the selected "PolygonFeatureSet" from previous step)

     

    Settings:  

     

    Geometry Service URL:  "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"

     

    Feature Set defined as "PolygonFeatureSet" 

     

    Unit: ESRI.ArcGIS.Client.Tasks.LinearUnit.USsurveyRod

     

    Union Results set to True

     

     

     
    0
  • Nico Burgerhart
    You have also defined a value for the Distance?

     

    The US Survey rod is new for me...
    0
  • Jostein Svegården
    Try:
    1. Use GetMapInfo to get the spatial reference of the map
    2. CaptureGeometry to get a point from the user
    3. QueryTask against your polygonlayer with the geometry from 2) as input geometry, the spatial reference from 1) as Out Spatial Reference (important) and Return Geometry = True
    4. Let's say that 3) returns a featureset called FeatureSet1 containing one polygon feature. Run QueryTasks against your point layers with FeatureSet1.Features.First.Geometry as input Geometry and ESRI.ArcGIS.Client.Tasks.SpatialRelationship.esriSpatialRelWithin as Spatial Relationship. Points within the selected polygon should be returned as FeatureSets
    5. Use a ForEach<Graphic> to go through the features in each FeatureSet to read their attributes or do whatever you need to do
    Hope this helps
    0
  • Jill Ryan
    Jostein,

     

    Thank you for the step by step...that's very helpful!  

     

    In 2) Capture Geometry, I have the Geometry set to "Geocortex.Workflow.Activities.GeometryCaptureType.Polygon".  What should the Result be?  I typed in polygonFeatureSet1 and I am getting this error: 

     

    Compiler error(s) encountered processing expression "polygonFeatureSet1".  Value of type 'ESRI.ArcGIS.Client.Tasks.FeatureSet' cnnot be converted to 'ESRI.ArcGIS.Client.Geometry.Geometry'.
    0
  • Jostein Svegården
    The geometry type of the CaptureGeometry is just the type of geometry that the user draws into the map, and that is returned by the task. I often use Geocortex.Workflow.Activities.GeometryCaptureType.MapPoint if I want the user to select only one polygon/parcel, with .GeometryCaptureType.Polygon, the user can be able to select more than one parcel if you want them to.

     

    The CaptureGeometry activity is only about having the user to enter a geometry into the map. You then use this geometry in your QueryTask to select what's inside it.

     

    From your description, it is difficult to say what causes your error. Please give a more detailed explaination, or paste in your workflow

     

    Jostein
    0
  • Jill Ryan
    If you'll let me know how, I have a .xaml file that I could send to you.

     

      We are using this workflow to create a report using several layers in our map.  That is why I need to select the points within a polygon.  (the polygon is a construction site, and the 2 layers of points are the Site Inspection and Observed Code Violation information collected by inspectors. )

     

    Thanks!
    0
  • Zack Robison
    The output of the captureGeometry activity is a geometry object, not a featureset object.  You need to set the output to an object of the appropriate class (geometry) and then you should be able to buffer or query with that object as needed.
    0
  • Jostein Svegården
    Jill, you could open your .xaml in a text editor and copy-paste the code here?. But let's explain it backwards:
    1. To select all the points within a polygon, you need to run a query on the point layer with the polygon's geometry as input
    2. To get the polygon's geometry you need to run a query on the polygon layer, and you can use an user defined input geometry to define which polygon to select.
    3. To get this user defined input geometry, you can run a CaptureGeometry activity. You decide what type of geometry the user can draw into the map. If you want just one polygon returned by 2), it can be wise to ask for a Geocortex.Workflow.Activities.GeometryCaptureType.MapPoint. If you want to be able to select from within more than one polygon, you could ask for an Extent, Line, MultiPoint etc.
    0
  • Zack Robison
    Jill,

     

    What happens when you make your CaptureGeometry output object of the class ESRI.ArcGIS.Client.Geometry.Geometry and use that object as the geometry input to your query with SpatialRelIntersects?
    0
  • Jill Ryan
    Hi Zack,

     

    Thanks for checking back!  I apologize for the delay in answering, I've been troubleshooting an issue with the workflow and didn't want to stop until I fixed it. (Although, it remains an unsolved issue : ).

     

    I inserted the Capture Geometry between my Get Map Info and a Query Task (that gets the polygon from the geometry object class.  However, when I run the workflow in my site, the option to click on a point to then click on the map never comes up...the workflow just spins and spins.

     

    I am using Display Capture Geometry and that seems to be working.   

     

    My issue now is that my points aren't being highlighted and I don't know think my "For Each" is grabbing the points from my 2 layersthat are selected from "within" the polygon.  They are not showing up in my report.

     

    I am using an existing workflow (that IS able to send the points from my 2 layers to a multi-layer report) and trying to alter it to use the WITHIN rather than a buffer (because using "buffer" leaves out several of the points).  That existing workflow sends all 3 layers of information to a multi-layer report.  

     

     
    0
  • Jostein Svegården
    Jill, when you use CaptureGeometry, you don't get to choose which kind of geometry to draw into the map. It just expects you to start clicking in the map inputting the geometrytype that you have set in the activity. If you want a dialog that lets the user decide the geometrytype, you have to use  DisplayCaptureGeometry. If you want as few user clicks as possible, use ConfigureWorkflowContainer to communicate with the user, and then capture the geometry of your choice with CaptureGeometry.

     

    For the highlighting, I can think of three things to check:
    1. Have you checked that your querytasks return features? Use an alert activity to display InspectionsFeatureSet.Features.Count or run a test on InspectionsFeatureSet.Features.Any. Alternatively read the content of InspectionsFeatureSet.ToJson().
    2. In the ForEach, you loop through InspectionsFeatureSet.Features(). Since Features is a property of FeatureSet and not a method, I would try to skipt the paranthesis and say foreach inspection in InspectionsFeatureSet.Features
    3. I have never used "AddMarkup" as a command, so I cannot say how it works. But "AddTemporaryMarkupGeometry" has worked well for me (is cleared by "ClearTemporaryMarkup")
    0
  • Jill Ryan
    Thank you.  Iunderstand about the CaptureGeometry, and I will look into all 3 tips this morning!

     

    Jill 
    0
  • Jill Ryan
    Ok, could we talk about the steps to enact number 1? 

     

    1)  I dragged the "Alert" activity into my workflow activity.  What is the activity that will count the Inspections Feature Set that then can be displayed in the Alert?  

     

    2) I completed 2) and it did not make a difference in the final report

     

    Thank you,

     

     
    0
  • Jostein Svegården
    Jill, Count is a property of FeatureSet.Features, so just read it out. Just put InspectionsFeatureSet.Features.Count.ToString() into the alert box.

     

    If your query task returns features, 2) and 3) should work
    0

Please sign in to leave a comment.