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.


        public void UnionShapes()
            IFeatureSet fs = FeatureSet.Open(@"C:\[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);

Last edited May 20, 2015 at 8:31 PM by mbayles, version 4