AnsweredAssumed Answered

IBufferConstruction.ConstructBuffers doesn't always return a result

Question asked by linkspa on Dec 3, 2015
Latest reply on Dec 11, 2015 by linkspa



In my program I've created a custom class 'PtClass' which contains an IPoint named 'Pt' and a collection of 'PtClass' named 'Surround'. This class can be written to and restored from XML.


I read several point features from a featureclass 'FC' with a feature cursor.

For every point feature I create an instance of 'PtClass', use the point feature coordinates to create 'Pt' - to be sure there is no link between the feature and the instance - and store the instance to a collection 'PtCollection'.

When finished, I loop every item in 'PtCollection' to search surrounding point features in 'FC' with a spatial cursor, find the corresponding items in 'PtCollection' and put them in 'Surround'.

Finally this collection is stored to XML.


Then I need some overlapping buffers around certain groups of 'PtClass' points (pointList is a List of 'Pt' from 'PtCollection'):


private IGeometryCollection BufferCollection(List<IPoint> pointList, ISpatialReference spatialReference,

                                         double bufferDistance, bool explodeBuffers, bool unionOverlapBuffers)


    IGeometryBag bufferBag = new GeometryBag() as IGeometryBag;

    bufferBag.SpatialReference = spatialReference;

    IGeometryCollection bufferCollection = bufferBag as IGeometryCollection;

    object missing = Type.Missing;




        // make a MultiPoint geometry from the collection IPoint's

        IMultipoint mp = new Multipoint() as IMultipoint;

        mp.SpatialReference = spatialReference;

        IGeometryCollection multiPoint = mp as IGeometryCollection;

        foreach (IPoint point in pointList)


            multiPoint.AddGeometry(point, ref missing, ref missing);



        // add the MultiPoint to a geometrybag

        IGeometryBag bag = new GeometryBag() as IGeometryBag;

        bag.SpatialReference = spatialReference;

        IGeometryCollection obstacleBag = bag as IGeometryCollection;

        obstacleBag.AddGeometry((IGeometry)multiPoint, ref missing, ref missing);


        // create an enumerator

        IEnumGeometry enumGeometry = obstacleBag as IEnumGeometry;


        // build buffers around the points

        IBufferConstruction bufferConstruction = new BufferConstruction();

        IBufferConstructionProperties bufferConstructionProperties =


        bufferConstructionProperties.ExplodeBuffers = explodeBuffers;

        bufferConstructionProperties.UnionOverlappingBuffers = unionOverlapBuffers;

        bufferConstruction.ConstructBuffers(enumGeometry, bufferDistance, bufferCollection);


    catch (Exception ex)


        // do something with the error



    return bufferCollection;



But sometimes it returns an empty collection, unless when I start the program anew, skip the 'FC' search and create 'PtCollection' from XML.


All the featurecursors are non-recycling and are released with Marshal.ReleaseComObject immediately afterwards. I'm using Visual Studio 2010 and ArcGIS 10.2.2.


Does it have anything to do with memory usage?