MapWinGeoProc:Utils AreaOfPart

This is a back-up of the WIKI.
Not all links might work
We're working on a new wiki.

Main Page | Recent changes | View source | Page history | Log in / create account |

Printable version | Disclaimers | Privacy policy



 double AreaOfPart(MapWinGIS.Shape polygon, int PartIndex)


Calculates the area of a part, without taking into consideration any other aspects of the polygon.


PartIndex The integer index of the part to obtain the area of.
This value will be ignored if the shape only has one part, and the function
will calculate the area of the entire shape.


A double value that is equal to the area of the part.


Coded by Ted Dunsford 6/23/2006, derived from Angela's Area algorithm
Code reference
Cached in MapWinGeoProc\clsUtils\Documentation\
I don't think that we ever want to return a negative area from this function,
even if the part is a hole, because it is being calculated outside of the
context of any other parts. Only the collective Area function should worry about
ascribing a sign value to the individual part areas.

Visual Basic Net 2005 Example Implementation Code

 ' Requires a reference to MapWinGIS
 ' Requires a reference to MapWinGeoProc
 Public Class Form1
     Implements MapWinGIS.ICallback
     Dim mwShapefile As New MapWinGIS.Shapefile
     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
         AxMap1.AddLayer(mwShapefile, True)
     End Sub
     Private Sub cmdGetArea_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGetArea.Click
         Dim shape As New MapWinGIS.Shape
         shape = mwShapefile.Shape(0)
         MessageBox.Show("Area 0: " & MapWinGeoProc.Utils.AreaOfPart(shape, 0))
         MessageBox.Show("Area 1: " & MapWinGeoProc.Utils.AreaOfPart(shape, 1))
     End Sub
     Public Sub [Error](ByVal KeyOfSender As String, ByVal ErrorMsg As String) Implements MapWinGIS.ICallback.Error
     End Sub
     Public Sub Progress(ByVal KeyOfSender As String, ByVal Percent As Integer, ByVal Message As String) Implements MapWinGIS.ICallback.Progress
         ProgressBar1.Value = Percent
     End Sub
 End Class

Visual C# 2005 Implementation Example code

 ' Requires a reference to MapWinGIS
 ' Requires a reference to MapWinGeoProc
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
 using System.Text;
 using System.Windows.Forms;
 namespace CSharpDemo
     public partial class Form1 : Form, MapWinGIS.ICallback 
         MapWinGIS.Shapefile mwShapefile;
         public Form1()
         private void cmdGetArea_Click(object sender, EventArgs e)
             MapWinGIS.Shape shape;
             shape = mwShapefile.get_Shape(0);
             MessageBox.Show("Area 0: " + MapWinGeoProc.Utils.AreaOfPart(shape, 0));
             MessageBox.Show("Area 1: " + MapWinGeoProc.Utils.AreaOfPart(shape, 1));
         private void Form1_Load(object sender, EventArgs e)
             mwShapefile = new MapWinGIS.ShapefileClass();
             mwShapefile.Open(@"C:\Temp\Triangles.shp", this);
             axMap1.AddLayer(mwShapefile, true);
         public void Error(string KeyOfSender, string ErrorMsg)
         public void Progress(string KeyOfSender, int Percent, string Message)
             progressBar1.Value = Percent;

Function added to MapWinGeoProc by Ted Dunsford 6/23/2006

Back to Utils

Retrieved from ""

This page has been accessed 1,206 times. This page was last modified on 26 June 2006, at 22:24.