we have a map that displays a large number of graphics (in a graphic layer). We set up the property myGraphicLayer.ProjectionService. We then create MapPoint's and set the spatial reference property. These map points are finally added as the geometry of the ESRI.ArcGIS.Client.Graphic objects which in turn go into the graphic layer.
GeometryService geomser = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
GraphicsLayer gl = new GraphicsLayer();
gl.ProjectionService = geomser;
this.mapControl1.map1.Layers.Add(gl);
//FROM HERE ON WE NORMALLY DO IT IN A LOOP TO ADD SEVERAL GRAPHICS
MapPoint p = new MapPoint(myLongitude, myLatitude, null);
p.SpatialReference = new ESRI.ArcGIS.Client.Geometry.SpatialReference(4267);
SimpleMarkerSymbol mark = new SimpleMarkerSymbol();
ESRI.ArcGIS.Client.Graphic g = new ESRI.ArcGIS.Client.Graphic();
g.Symbol = mark;
g.Geometry = p;
gl.Graphics.Add(g);
We have noticed (and timed) the process of adding the graphics to the layer in a loop as described before. That does not take any time at all; yet the application pretty much freezes. We have checked in several points and it seems to be waiting on the projection service to comeback. My guess is that it sends the projections one by one and it is waiting for all of them to comeback?? Is there any way for us to set this up in a way that it sends a batch to the projection service? If not, then is there a way to make this work in a multi-threaded environment so the projections are happening yet the client can continue working?thanks!