Does ArcObjects ConstructUnion operation sometimes fail to merge touching parcels?

750
3
09-24-2013 08:12 PM
ValMacduff
New Contributor
I have some code which identifies touching parcels and uses ConstructUnion to produce a single polygon from them. Just occasionally
the touching parcels remain unmerged even though they have been selected with esriSpatialRelTouches. Is this a known bug? Or,
the reason might be that I am using a geometryBag to store the parcels to be merged. The constructUnion documentation states
that it does not work on a geometrybag but I cannot find a single example on the web of anything else being used instead - can
anyone advise what I should be using?  I am working with shapefiles.

Val
0 Kudos
3 Replies
HailiangShen
New Contributor
Here is a link to one example of ConstructUnion: http://forums.esri.com/Thread.asp?c=93&f=1170&t=80838

One possibility is your polygon is not simple. I had the same issue. The polygon ring must be clockwise, if it is not constructed this way, your polygon is not simple and you need to simplify it shown in the link above before you put it into geometry bag.
0 Kudos
BennettChamberland
New Contributor
You can try using a ITopologicalOperator and just Union them together. 

in c++ assuming ipGeometryOne and ipGeometryTwo are valid IGeometryPtr's:

HRESULT hr = ((ITopologicalOperatorPtr)ipGeometryOne)->Union(ipGeometryTwo, &ipGeometryOne);
0 Kudos
ValMacduff
New Contributor
Shenh,

Thank you for your response. I think that anti-clockwise rings are almost certainly causing the problem as the data I am working with is not always very clean. Interestingly, ARCMAP Dissolve does not have a problem with the same data so I am looking at using that in Python instead of ArcObjects. It is a great deal faster than my own ArcObjects code.

Val
0 Kudos