I am writing a arc engine application that can take a shapefile, and merge a set of polygons together.
Here is the code that I am using to merge the polygons:
private static void mergeFeatures(IFeature merger, IFeature mergee)
{
ITopologicalOperator union = (ITopologicalOperator)mergee.Shape;
mergee.Shape = union.Union(merger.Shape);
merger.Delete();
mergee.Store();
}
Is this the best solution to merge polygons? In my application this part of my code takes 60% of the execution time.
Is it slow because I am using a shapefile? Does a file geodatabase help with this? Or is this even just the totally wrong approach for merging polygons.
Just to clarify, I am taking a large set of polygons and am trying to merge ones under a certain number of acreage. From these polygons that are small, I need to merge polygons with similar attributes (for example on a vegetation layer, ones that are similar vegetation.) So this can incur a large number of small polygons getting merged together, and eliminating some of the merges can be difficult. If there is an easier way to bulk merge, then that would be best, but thus far, I have not found one.