How could I build a multiple ring buffer/query analysis in my silverlight project? I have a working evacuation zone analysis in my project where I can query all elements within a specified distance from a point (f.e. all the companies within a 500m radius of a possible bomb threat). I would now like to expand this analysis to different threat zones, there the innermost circle of 250m is the 'evacuate immediately' zone, a surrounding zone of 200 m is the 'stay inside zone' and a third zone of 50m is the 'warning zone'.

I have based my code on the example code of the ArcGIS developers website for the silverlight API.

    public BufferQuery()

        _geometryService =
        new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
        _geometryService.BufferCompleted += GeometryService_BufferCompleted;
        _geometryService.Failed += GeometryService_Failed;

        _queryTask = new QueryTask("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer/2");
        _queryTask.ExecuteCompleted += QueryTask_ExecuteCompleted;
        _queryTask.Failed += QueryTask_Failed;

        _pointAndBufferGraphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
        _resultsGraphicsLayer = MyMap.Layers["MyResultsGraphicsLayer"] as GraphicsLayer;

    private void MyMap_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)

        Graphic clickGraphic = new Graphic();
        clickGraphic.Symbol = LayoutRoot.Resources["DefaultMarkerSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; 
        clickGraphic.Geometry = e.MapPoint;
        // Input spatial reference for buffer operation defined by first feature of input geometry array
        clickGraphic.Geometry.SpatialReference = MyMap.SpatialReference;



        // If buffer spatial reference is GCS and unit is linear, geometry service will do geodesic buffering
        ESRI.ArcGIS.Client.Tasks.BufferParameters bufferParams = new ESRI.ArcGIS.Client.Tasks.BufferParameters()
            BufferSpatialReference = new SpatialReference(4326),
            OutSpatialReference = MyMap.SpatialReference,
            Unit = LinearUnit.Meter,


    void GeometryService_BufferCompleted(object sender, GraphicsEventArgs args)
        Graphic bufferGraphic = new Graphic();
        bufferGraphic.Geometry = args.Results[0].Geometry;
        bufferGraphic.Symbol = LayoutRoot.Resources["BufferSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol; 


        ESRI.ArcGIS.Client.Tasks.Query query = new ESRI.ArcGIS.Client.Tasks.Query();
        query.ReturnGeometry = true;
        query.OutSpatialReference = MyMap.SpatialReference;
        query.Geometry = bufferGraphic.Geometry;

    private void QueryTask_ExecuteCompleted(object sender, QueryEventArgs args)
        if (args.FeatureSet.Features.Count < 1)
            MessageBox.Show("No features found");

        foreach (Graphic selectedGraphic in args.FeatureSet.Features)
            selectedGraphic.Symbol = LayoutRoot.Resources["ParcelSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol;

    private void GeometryService_Failed(object sender, TaskFailedEventArgs args)
        MessageBox.Show("Geometry service failed: " + args.Error);

    private void QueryTask_Failed(object sender, TaskFailedEventArgs args)
        MessageBox.Show("Query failed: " + args.Error);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.