Select to view content in your preferred language

Negative Area?

874
2
Jump to solution
01-17-2013 11:28 AM
PhilipKnight1
Regular Contributor
Bear with me, I am a developer who just recently started working with a GIS API. I also looked at this thread but that didnt help at all even though the problem seems similar.

I am using version 3.0 of the Silverlight API:

I am trying to get the area of a polygon. In our software there is already functionality to get the perimeter/length in feet, which appears to be working correctly:

                //converts points to WGS84 (WKID=4326) and then does math on converted points         private double CalcWorldLength(MapPoint pt1, MapPoint pt2)         {             WebMercator web = new WebMercator();             MapPoint wgsPt1 = (MapPoint)web.ToGeographic(pt1);             MapPoint wgsPt2 = (MapPoint)web.ToGeographic(pt2);             double[] ppt1 = ProjectPoint(wgsPt1.X, wgsPt1.Y);             double[] ppt2 = ProjectPoint(wgsPt2.X, wgsPt2.Y);             double ret = Math.Round(Math.Abs(Math.Pow((Math.Pow((ppt2[0] - ppt1[0]), 2) + Math.Pow((ppt2[1] - ppt1[1]), 2)), .5)));             return ret;         }


I am trying to add functionality to get the area of a polygon, but I routinely get incorrect values for the area, and even length. I have tried getting the area and length by incorporating the example Area and Perimeter:

geometryService.AreasAndLengthsAsync(graphicList, ESRI.ArcGIS.Client.Tasks.LinearUnit.Foot, ESRI.ArcGIS.Client.Tasks.LinearUnit.Foot,CalculationType.Geodesic);


but I found that the answer is consistently off in both area and length by a particular ratio (unit values being returned are always ~1.35x bigger than they should be).

I also tried using the function "ESRI.ArcGIS.Client.Geometry.Euclidian.Area", but I keep getting back relatively small or negative numbers. I am passing the function a polygon in the spatial Reference of 4326 (WKID).


Any ideas?
0 Kudos
1 Solution

Accepted Solutions
DominiqueBroux
Esri Frequent Contributor
but I found that the answer is consistently off in both area and length by a particular ratio (unit values being returned are always ~1.35x bigger than they should be).


To get accurate results, you have better to use Equal Area Projection such as WKID 54034.
Your result is likely due to the Web Mercator distorsion which is 1/cos(latitude).


That being said, the best approach is likely to use the built-in geodesic methods.
This method should return accurate results when your input in in geographical coordinates and is Superior to the Euclidian method that you tested.

Note that a negative value is normal if your polygon is oriented in a counter clock wise direction.

View solution in original post

0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
but I found that the answer is consistently off in both area and length by a particular ratio (unit values being returned are always ~1.35x bigger than they should be).


To get accurate results, you have better to use Equal Area Projection such as WKID 54034.
Your result is likely due to the Web Mercator distorsion which is 1/cos(latitude).


That being said, the best approach is likely to use the built-in geodesic methods.
This method should return accurate results when your input in in geographical coordinates and is Superior to the Euclidian method that you tested.

Note that a negative value is normal if your polygon is oriented in a counter clock wise direction.
0 Kudos
PhilipKnight1
Regular Contributor
To get accurate results, you have better to use Equal Area Projection such as WKID 54034.
Your result is likely due to the Web Mercator distorsion which is 1/cos(latitude).


That being said, the best approach is likely to use the built-in geodesic methods.
This method should return accurate results when your input in in geographical coordinates and is Superior to the Euclidian method that you tested.

Note that a negative value is normal if your polygon is oriented in a counter clock wise direction.



Thank you so much for the relatively quick reply! I will try out your advice.
0 Kudos