Select to view content in your preferred language

BufferAsync not executing

560
2
03-11-2011 02:13 PM
JackCibor
Frequent Contributor
I am trying to use BufferAsync to execute a buffer around a point graphic in this case. When monitoring in Fiddler there doesn't seem to be any action generated at all. I don't think a request is being sent to the server at all. It behaves the same way no matter which GeometryService I use, ESRI's or my own. I am using the code almost exactly as it is in the Samples. Anyone see any obvious issues here. I have separated the code for the geocode and that of the buffer into separate functions just to keep it clear for me.  So the buffer is executing after a Click Event.

          private void BufferAddressButton_Click(object sender, RoutedEventArgs e)
        {
            _geometryService = new GeometryService("http://myServer/ArcGIS/rest/services/Geometry/GeometryServer");
            _geometryService.BufferCompleted += GeometryService_BufferCompleted;
            _geometryService.Failed += GeometryService_Failed;
            
            
            _geometryService.CancelAsync();


            BufferParameters buffParameters = new BufferParameters();
            buffParameters.Unit = LinearUnit.StatuteMile;
            buffParameters.BufferSpatialReference = new SpatialReference(54034);
            buffParameters.OutSpatialReference = Map1.SpatialReference;
            buffParameters.UnionResults = true;


            GraphicsLayer graphicsLayerAddress = Map1.Layers["AddressSearched"] as GraphicsLayer;
            
            Graphic graphic = graphicsLayerAddress.Graphics[0];
            //buffParameters.
            
            buffParameters.Distances.Add(2);
            buffParameters.Features.Add(graphicsLayerAddress.Graphics[0]);


            _geometryService.BufferAsync(buffParameters);
        }  
0 Kudos
2 Replies
ChristopherHill
Deactivated User
I need a little more info:

1) Is there any Exception being thrown?
2) Map spatial reference is 54034?
3) graphicsLayerAddress.Graphic[0].Geometry.SpatialReference is 54034?

Thanks
0 Kudos
JackCibor
Frequent Contributor
The answer came in a reply to a question I asked in another thread, which I didn't expect to solve this problem, but it did.

I was not setting the spatial reference for the graphic I was trying to buffer when I was creating that graphic.

As soon as I put a "graphic.Geometry.SpatialReference = new SpatialReference(4326);" into the code that created the input graphic for the buffer operation, everything worked great.
0 Kudos