iaminsu12

Spatial Query Error

Discussion created by iaminsu12 on Mar 13, 2013
Latest reply on Mar 14, 2013 by whe-esristaff
Hello,

I have a serious problem with spatial query in ArcObject.

                    IRelationalOperator relOperInsideBarriers = (IRelationalOperator) fcInsideBarriers
                    IGeometryBag gbTotalConvexPathSplit = fcUtils.getGeoBag(fcTotalConvexPathSplit);
                    if (relOperInsideBarriers.Crosses(gbTotalConvexPathSplit) == false)
                    {
                        Console.WriteLine("Break");

                        break;
                    }


Code is simple. I update featureclass "fcTotalConvexPathSplit" before this codeblck using other operations, then check 'crossing' with fcInsideBarriers.

fcTotalConvexPathSplit is line, and fcInsideBarriers is polygon.

"relOperInsideBarriers.Crosses(gbTotalConvexPathSplit)" is supposed to return false there is no line in fcTotalConvexPathSplit crosses fcInsideBarriers, right?

But, it return false when there are many number of crossings.

I tried to simplify it, like below



                    IGeometryBag gbTotalConvexPathSplit = fcUtils.getGeoBag(fcTotalConvexPathSplit);
                    ITopologicalOperator pTopOp = gbTotalConvexPathSplit as ITopologicalOperator;
                    pTopOp.Simplify();
                    IGeometry igTopo = pTopOp as IGeometry;
                    if (relOperInsideBarriers.Crosses(igTopo) == false)
                    {
                        Console.WriteLine("Break");

                        break;
                    }



But result was same. It makes error.


I also tried to use ISpatialFilter, but it made similar error, though it sometimes could produce right result, but otherwise couldn't.



What's going on here. I cannot figure out what the problem is...



Thank you

Outcomes