UnionShapesCS - sindizzy/DSW GitHub Wiki

Union Intersecting Shapes in a FeatureSet

This example shows how to use a newly added extension method that allows for intersecting shapes in the same Shapefile to be Unioned, but leaving shapes that don't overlap unchanged.

[Image:UnionIntersecting.png)(Image_UnionIntersecting.png)

public void UnionShapes()
{
    IFeatureSet fs = FeatureSet.Open(@"C:\[Your File Path](Your-File-Path)\Centroids.shp");
    IFeatureSet result = fs.UnionShapes(ShapeRelateType.Intersecting);
    SaveFileDialog sfd = new SaveFileDialog();
    sfd.Filter = "**Shapefiles (**.shp)|**.shp";
    if (sfd.ShowDialog() != DialogResult.OK) return;
    result.SaveAs(sfd.FileName, true);
}