Convert IEnumerable(Of ESRI.ArcGISClient.Graphic) to Geometry?
Hi All,
I have a simple workflow where a user clicks on a Street Segment, then it is supposed to Buffer that Geometry and pass it into the rest of the workflow.
I need to buffer the Geometry of the clicked location because most people wont be able to precisely click on the Street Segment, being such a thin line.
The buffered geometry is meant to act as a way to definitely capture the Street Segment the user's are trying to click on, kind of like setting a pixel tolerance.
My problem is when I buffer the clicked location, it results in a 'System.Collections.Generic.IEnumerable(Of ESRI.ArcGIS.Client.Graphic)' variable.
However I need to turn that result back into a ESRI.ArcGIS.Client.Geometry.Geometry variable, below is what i'm looking at.
It's probably a simple fix, but I can't seem to figure it out. I need it back into a Geometry, because that Geometry will be used in a Query section later on in the workflow.
I hope this makes sense, any help would be really appreciated!
/customer/servlet/servlet.FileDownload?file=00P6000000elu4aEAA
-
Hi Robin, I am having the same issue. I know this was several years ago, just wondering if you found a fix and can share it?
Thanks so much.Darryl
0 -
Hi Darryl,
The Buffer task returns an enumeration of graphics because you can feed multiple geometries into it. An enumeration of Graphics is also convenient because a FeatureSet is also an enumerable collection of Graphics objects.
You can guarantee that the buffer task will return an enumeration with one Graphic in it by setting the Union Results parameter to True.
Then, you can get the Geometry of the first element in the enumeration using the expression:iEnumerable1.First().Geometry...where iEnumerable1 is the enumeration returned by the Buffer Task.
Note that First() will fail if there are zero elements in the enumeration, so you may want to use a try/catch to handle that possible outcome (if it's indeed possible to run the buffer on nothing).
Regards,
-Malcolm0 -
You can use the Unioned Result in stead of the Result out argument, this will return a single geometry and not a list. The Unioned Result out argument is available in more recent versions of the Workflow Designer. 0
Please sign in to leave a comment.
Comments
3 comments