## CentroidOfPart

**Syntax**

MapWinGIS.Point CentroidOfPart(MapWinGIS.Shape polygon, int PartIndex)

**Summary**

This function will calculate the centroid for a specific part of
a

Mapwinshape. If the shape has only one part, the integer
value

PartIndex will be ignored, and the centroid for the entire
shape

will be calculated.

**Parameters**

polygon |
MapWinGIS.Shape of type POLYGON/POLYGONZ/POLYGONM to obtain the centroid of or containing the specific part to obtain the centroid of. |

PartIndex |
The integer index value of the part in polygon to find the centroid of. This value will be ignored if there is only one part in the polygon, and teh centroid for the entire shape will be returned. |

**Returns**

A MapWinGIS.Point representing the position of the

two dimensional centroid of the part of polygon specified by

PartIndex

**Remarks**

Initially authored by Ted Dunsford on 6/23/2006

Derived from Angela's algorithm, but heavily modified

Visual Basic Net 2005 Example
Implementation Code

Visual C# 2005 Example Implementation
Code

Back to
Utils