AnsweredAssumed Answered

ConstructUnion - shift

Question asked by sonj on Feb 28, 2020
Latest reply on Mar 12, 2020 by sonj

The data is in 'GCS_WGS_1984' and creating union polygon using IToplogicalOperator2.ConstructUnion successfully in different type of codes but in both cases found union polygon shift.

 

//Case-1

while ((feature = featureCursor.NextFeature()) != null)
{
ITopologicalOperator2 shape = feature.ShapeCopy as ITopologicalOperator2;
shape.IsKnownSimple_2 = false;
shape.Simplify();

geometriesToUnion.AddGeometry(shape as IGeometry, ref missing, ref missing);
}


IGeoDataset geoDataset = ipTargetFeatureClass.FeatureDataset as IGeoDataset;

IPolygon UnionPolygon = new PolygonClass();
UnionPolygon.SpatialReference = geoDataset.SpatialReference;
ITopologicalOperator2 topologicalOperator;
topologicalOperator = UnionPolygon as ITopologicalOperator2;

topologicalOperator.ConstructUnion(geometriesToUnion as IEnumGeometry);

 

//Case-2

while ((feature = featureCursor.NextFeature()) != null)
{
ITopologicalOperator2 shape = feature.ShapeCopy as ITopologicalOperator2;
shape.IsKnownSimple_2 = false;
shape.Simplify();

geometriesToUnion.AddGeometry(shape as IGeometry);
}

ITopologicalOperator2 topologicalOperator = new PolygonClass();
topologicalOperator.ConstructUnion(geometriesToUnion as IEnumGeometry); // union all features

Please suggest if anything missing in the code

Outcomes