ITopologicalOperator.Union gives inaccurate coordinates in the result

Discussion created by jdavids on Dec 23, 2010
Hi all

I've uncovered some strange behaviour using the Union method on the ITopologicalOperator interface. It appears that two subsequent calls to the union method are not independent. I.e. there appears to be some caching in the back-end ArcObjects, whereby the first call to a union method affects the results of a subsequent call to the union method (on some other, unrelated geometries!).

Step 1: I union two (identical) geographic polygons and the results returned are correct, with no coordinate inaccuracy. I.e. the output polygon's coordinates are exactly the same as the input polygons' coordinates (to 7 decimal places). All good up to this point.

Step 2: I union two (identical) projected polygons and again the results are correct, as expected.

Step 3: I repeat step 1 which unions the geographic polygons, and this time, the coordinates of the resultant polygon are inaccurate. Where previously results were perfect up to the 7th decimal place, they now have distortion at that 7th decimal place. It appears that the union of projected polygons (step 2) somehow "corrupts" subsequent unions of geographic coordinates (step 3).

I'm pretty sure I have correctly set the spatial references on various input geometries. Further, I've played around with tolerance and resolution settings on the spatial references and I haven't found anything that solves the problem.

In the attached zip file is a Visual Studio 2005 solution with a simple windows forms project which demonstrates the problem. A form contains two buttons: one to union the geographic polygons and one to union the projected polygons. Depending on the order in which the buttons are clicked, the output is different for the union of the geographic polygons.

Thanks in advance

P.S. I've tested this against ArcGIS 9.3.1. Perhaps somebody could test it against version 10?