shenglinxu

ConstructUnion method some time returning an empty geometry

Discussion created by shenglinxu on Jun 7, 2010
Latest reply on Aug 7, 2013 by andrea125
I found ConstructUnion method some time returning an empty geometry even all the geometries added are not empty.
Could you help to find out why? Is it a known issue?


// Sample code
IGeometry pGeomBag = null;
IGeometryCollection geometryCollection = null;

pGeomBag = new GeometryBagClass();
                                    
pGeomBag.SpatialReference = objFeature.ShapeCopy.SpatialReference;
geometryCollection = (IGeometryCollection)pGeomBag;

//buffer each selected roads and add to geometryCollection

geometryCollection.AddGeometry(objBufferResult, ref missing, ref missing);

//Do construct union

IPolygon polygon = new PolygonClass();
ITopologicalOperator2 objTopo = polygon as ITopologicalOperator2;
if (objTopo != null)
{
objTopo.ConstructUnion((IEnumGeometry)pGeomBag);
        objTopo.IsKnownSimple_2 = false;
        objTopo.Simplify();

IGeometry objExclusion = new PolygonClass();               
         objExclusion = (IGeometry)objTopo;
}

Outcomes