## Intersection

**Syntax**

MapWinGIS.Shape Intersection(MapWinGIS.Shape poly1, MapWinGIS.Shape poly2)

**Summary**

Returns a new polygon representing the point set intersection of polygon1 with polygon2. Since v4.7 it returns null if no intersection was found.

**Parameters**

poly1 |
The 2D polygon in need of clipping. |

poly2 |
The 2D polygon used for clipping poly1. |

**Returns**

Shape containing all points in poly1 that are also in poly2.

Visual Basic Net 2005 Example
Implementation Code

Visual C# 2005 Example Implementation
Code

Back to
SpatialOperations

**Sample Code** C#

MapWinGIS.Shape intersect = new MapWinGIS.ShapeClass(); intersect.ShapeType = inputSF.ShapefileType; intersect = SpatialOperations.Intersection(shp1, shp2); if (intersect != null) { if (intersect.numPoints != 0 && intersect.IsValid) { // Shapes intersect } else { // Intersection returned an invalid shape return false; } }