Select to view content in your preferred language

Adding Multiple Point's of Coordinate

1899
10
12-07-2011 04:31 AM
MuhammadWaqar_ul_islam
Occasional Contributor
i m using http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Project sample to plot x,y values
i have add a text file that contain x,y value and plot a last point[x,y] from an array values

My problem is how to add multiple point value from an array not a single value
when i run this code

double ax = 0 ; double ay = 0;
          MapPoint inputMapPoint = new MapPoint(ay, ax, new SpatialReference(4326));
          while (i <= count)
          {
              double.TryParse(test[i, 0], out ax);
              double.TryParse(test[i, 1], out ay);
              inputMapPoint.X = ay;
              inputMapPoint.Y = ax;
              geometryService.ProjectAsync(new List<Graphic>() { new Graphic() { Geometry = inputMapPoint } }, MyMap.SpatialReference, inputMapPoint);
              i++;
          }

its gives this error "Task does not support concurrent I/O operations. Cancel the pending request or wait for it to complete."

geometryService.ProjectAsync(new List<Graphic>() { new Graphic() { Geometry = inputMapPoint } }, MyMap.SpatialReference, inputMapPoint);
0 Kudos
10 Replies
CHRISTOSCHARMATZIS
Deactivated User
THE PROBLEM WITH THE I/O operations IS THAT YOU DON'T NEED ALL THESE....
CHECK THIS LINK
http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/help/Geometry_task.htm

AT THE PROJECT PARAGRAPH..

GeometryService geometryService = new GeometryService("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/" +
"Geometry/GeometryServer");
geometryService.ProjectCompleted += GeometryService_ProjectCompleted;
GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
geometryService.ProjectAsync(graphicsLayer.Graphics.ToList(), new SpatialReference(54025));




AND THEN...
private void GeometryService_ProjectCompleted(object sender, ESRI.ArcGIS.Client.Tasks.GraphicsEventArgs args)
{
GeometryService geometryService = new GeometryService("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/" +
"Geometry/GeometryServer");
geometryService.AreasAndLengthsCompleted += GeometryService_AreasAndLengthsCompleted;
geometryService.AreasAndLengthsAsync(args.Results);
}


THAT WORKED FOR ME...!!!
0 Kudos