private void GeometryService_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs args) { //TODO: Geometry service not returning correct values, area unit seems invalid, may need to use data in //planar coordinate space // convert results from meters into miles and sq meters into sq miles for our display double miles = args.Results.Lengths[0] * 0.0006213700922; double sqmi = Math.Abs(args.Results.Areas[0]) * 0.0000003861003; ResponseTextBlock.Text = String.Format("Polygon area: {0} sq. miles\nPolygon perimeter: {1} miles.", Math.Round(sqmi, 3), Math.Round(miles, 3)); }
I'm still in need of the question I posted eailer but no I ran into another problem so I was hoping if someone was kind enough to answer one maybe they have the knowledge to do both.
So I've implemented the "area and perimeter" (http://help.arcgis.com/en/webapi/silverlight/2.1/samples/start.htm#AreasAndLengths) and the "Line Length" (http://help.arcgis.com/en/webapi/silverlight/2.1/samples/start.htm#Lengths)
I've add a button to clear the graphics and switch back and fourth between the two but I can't seem to figure out how to get out of them. I mean what do I need to call to get back to the normal mouse clicks....so the left mouse click stops drawing line or polys and can pan or zoom (like the default mouse actions.).....
Thanks
MyDrawObject.IsEnabled = false;
I'm using this example and it works great in the example with projection 102100 but I'm using projection 4326 WGS 1984 esridecimaldegrees and my numbers are way off can someone tell what I need to change
buthttp://help.arcgis.com/en/webapi/silverlight/samples/start.htm#AreasAndLengths
I think it is here but not sureprivate void GeometryService_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs args) { //TODO: Geometry service not returning correct values, area unit seems invalid, may need to use data in //planar coordinate space // convert results from meters into miles and sq meters into sq miles for our display double miles = args.Results.Lengths[0] * 0.0006213700922; double sqmi = Math.Abs(args.Results.Areas[0]) * 0.0000003861003; ResponseTextBlock.Text = String.Format("Polygon area: {0} sq. miles\nPolygon perimeter: {1} miles.", Math.Round(sqmi, 3), Math.Round(miles, 3)); }
private void MyDrawObject_DrawComplete(object sender, DrawEventArgs args) { ESRI.ArcGIS.Client.Geometry.Polygon polygon = args.Geometry as ESRI.ArcGIS.Client.Geometry.Polygon; polygon.SpatialReference = MyMap.SpatialReference; Graphic graphic = new Graphic() { Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol, Geometry = polygon, }; GeometryService geometryService = new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); geometryService.AreasAndLengthsCompleted += GeometryService_AreasAndLengthsCompleted; geometryService.Failed += GeometryService_Failed; GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; graphicsLayer.Graphics.Add(graphic); List<Graphic> graphicList = new List<Graphic>(); graphicList.Add(graphic); geometryService.AreasAndLengthsAsync(graphicList, LinearUnit.SurveyMile, LinearUnit.SurveyMile, null); } private void GeometryService_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs args) { ResponseTextBlock.Text = String.Format("Polygon area: {0} sq. miles\nPolygon perimeter: {1} miles.", Math.Round(args.Results.Areas[0], 3), Math.Round(args.Results.Lengths[0], 3)); }
private void MyDrawObject_DrawComplete(object sender, DrawEventArgs args) { ESRI.ArcGIS.Client.Geometry.Polygon polygon = args.Geometry as ESRI.ArcGIS.Client.Geometry.Polygon; polygon.SpatialReference = MyMap.SpatialReference; Graphic graphic = new Graphic() { Symbol = LayoutRoot.Resources["DefaultFillSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol, Geometry = polygon, }; GeometryService geometryService = new GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); geometryService.AreasAndLengthsCompleted += GeometryService_AreasAndLengthsCompleted; geometryService.Failed += GeometryService_Failed; GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer; graphicsLayer.Graphics.Add(graphic); List<Graphic> graphicList = new List<Graphic>(); graphicList.Add(graphic); geometryService.AreasAndLengthsAsync(graphicList,LinearUnit.Meter, LinearUnit.Meter, null); } private void GeometryService_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs args) { //TODO: Geometry service not returning correct values, area unit seems invalid, may need to use data in //planar coordinate space // convert results from meters into miles and sq meters into sq miles for our display double miles = args.Results.Lengths[0] * 0.0006213700922; double sqmi = Math.Abs(args.Results.Areas[0]) * 0.0000003861003; ResponseTextBlock.Text = String.Format("Polygon area: {0} sq. miles\nPolygon perimeter: {1} miles.", Math.Round(sqmi, 3), Math.Round(miles, 3)); }