[mapguide-users] RE: Calculate the area of a polygon

Hans Milling hm at geograf.dk
Tue Feb 28 02:36:01 EST 2012


And translated into human readable c# code :-) 
Assuming that the first point of the array is the same as the last point of
the array

        double area = 0;

        for (int i = 0; i < points.Length; i++)
        {
          int next = i+1;
          if (next == points.length)
           next = 0;

          area = (points[i].x * points[next].y) - (points[next].x *
points[i].y);
        }
        area = area / 2.0;

Hans...

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Calculate-the-area-of-a-polygon-tp4514611p4520450.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list