I have a graphics layer with multiple graphics in it and I wish to use all of those geometries to perform a Query. This following code works fine as far as doing my Query but of course is only using the geometry of the last graphic in my previous buffer results is used.
Private Sub GeometryService_BufferCompleted(ByVal sender As Object, ByVal e As GraphicsEventArgs)
Try
Dim graphicsLayer As GraphicsLayer = TryCast(MyMap.Layers("MyUserDrawnGraphicsLayer"), GraphicsLayer)
graphicsLayer.Graphics.Clear()
Dim iZIndex As Integer = 0
Dim comboBufferGraphic As New Graphic
For Each bufferGraphic As Graphic In e.Results
comboBufferGraphic.Geometry = bufferGraphic.Geometry
bufferGraphic.Symbol = TryCast(LayoutRoot.Resources("BufferSymbol"), Symbol)
bufferGraphic.SetZIndex(iZIndex)
graphicsLayer.Graphics.Add(bufferGraphic)
iZIndex = iZIndex + 1
Next
Dim query As New ESRI.ArcGIS.Client.Tasks.Query()
query.ReturnGeometry = True
query.Geometry = comboBufferGraphic.Geometry
query.OutSpatialReference = MyMap.SpatialReference
query.OutFields.Add("SUE")
query.OutFields.Add("LEGAL")
_queryTask.ExecuteAsync(query)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
It would seem that a Tasks.Query only accepts one Geometry value as the Geometry property so my question is how do I combine the geometries of all of my graphics?I have searched for a geometry.add function or aggregate or combine and had no luck.There is not an obvious way to export the geometries to strings, combine and then create a new geometry from that coord string. If there is I would be glad to have it pointed out to me.Any thoughts on this would be most appreciated.RegardsRalph PriceApplication Developer and GIS Analyst