Select to view content in your preferred language

compare areas of Identify results

679
3
12-19-2011 10:24 AM
DaveOrlando
Frequent Contributor
Hello,

has anybody done something similar?...

I would like to compare the areas of the features returned from the 'identify' task before I add them to the list. I will create some code to sort the results in order of area, but the problem I have is that for display purposes I have hidded the 'area' field.

Is there a function out there that can do an area calculation based on the returned geometry (polygon)? using the rings maybe?.....

thanks,
0 Kudos
3 Replies
JenniferNery
Esri Regular Contributor
If you are using API version 2.3 or 3.0 Beta 1, you can use this method: http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Geometry.G....
0 Kudos
DaveOrlando
Frequent Contributor
Unfortunately I am still in the dark ages of 2.2

I am taking my results from the Identify and feeding them into the GeometryService AreasAndLengths method, but I think I am about to abort for a few reasons.

1. the service takes too long to return and
2. I don't think I'll be able to reattach the areas to the proper polygon with certainty

have you seen a way to attach the results of the AreaAndLengths back onto the features (IList<Graphic>) being passed in? or add to an area property in the DataItem class show in the Identify example?
0 Kudos
JenniferNery
Esri Regular Contributor
Yes, you can use 2nd parameter UserState, this can be any data type, which you can cast to the correct type in the completed event.

   geometryService.AreasAndLengthsCompleted += (s, e) =>
    {
     var originalGraphics = e.UserState as List<Graphic>;
     if (originalGraphics != null)
     {
     };
    };
   geometryService.AreasAndLengthsAsync(graphics, graphics);
0 Kudos