Skip to main content

Convert IEnumerable(Of ESRI.ArcGISClient.Graphic) to Geometry?

Comments

3 comments

  • Darryl Klassen

    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
  • Permanently deleted user
    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,

     

    -Malcolm
    0
  • Nico Burgerhart
    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.