ThinkGeo.com    |     Documentation    |     Premium Support

GetArea() area calculation issue

Hi all,
I found that GetArea() when dealing with large polygons returns a bit different number than arcmap or other gis apps do.
I even made my own function to see if that was the case and yes my function returned a value equal to other gis . The problem turns to be that of an accuracy, cause it is observable when we deal with large numbers.
Thanks

Hi George,

The large polygon means many polygons or a big polygon?

And please make sure the unit, if your map unit is meter, you can just pass the unit in. But if that’s decimal degree please refer our sample here:

http://wiki.thinkgeo.com/wiki/Map_Suite_Desktop_Edition_Projection_Samples#measurements_decimal_degrees

Wish that’s helpful.

Regards,

Ethan

Hi Ethan,
Thanks for your reply. In the link you can find the polygon. So for this polygon i use something like

area = (feature.GetShape() as PolygonShape).GetArea(GeographyUnit.Meter, AreaUnit.SquareMeters);

and the results are Thinkgeo 3785671.875 , ArcGis 3785672.3968, QGIS 3785672.39648438 and me 3785672.396484375
So there is a bit difference but Thinkgeo has the biggest. I use GetArea() a lot in order to calculate area based statistics and i always have different results from others which is annoying, Do i have to replace GetArea()?
ASTOTA.zip (6.9 KB)

Hi George,

It looks that should be a problem from the 3rd part dll we referenced.

Here we have a workaround for it, please use the area2, it should get the correct result:

            ShapeFileFeatureLayer source = new ShapeFileFeatureLayer(@"D:\ASTOTA.SHP");
        source.Open();
        Collection<Feature> fs = source.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns);

        PolygonShape poly = (fs[0].GetShape() as MultipolygonShape).Polygons[0];
        double area = poly.GetArea(GeographyUnit.Meter, AreaUnit.SquareMeters);

        var wkb = poly.GetWellKnownBinary();
        var wkbReader = new NetTopologySuite.IO.WKBReader();
        var geometry = wkbReader.Read(wkb);

        double area2 = geometry.Area;

Regards,

Ethan

Thank you Ethan, that solved the problem,
Regards ,
George

Hi,

I am glad to hear that’s helpful.

Regards,

Ethan