Quantcast
Channel: Forums - ArcObjects SDKs
Viewing all articles
Browse latest Browse all 1374

Spatial Query error

$
0
0
Hi guys

I've got a problem with spatial query.

I generate IGeometry igPairLine and compare it a map boundary (IGeometrybag gbBaseMap) using IRelationalOperator.

The purpose is checking whether a line is within the map boundary or not.

I repeat this process for thousands of thousands lines (literally). But 60 of them were wrong. My code determined they are within the map boundary, but actually not.

I don't know why exact same code make such error for certain cases.

Does anybody know why?


Thank you



Code:

                  ISpatialReference sRef;
                            ifMerged = fcMerged.GetFeature(1);
                            IPoint pt = new PointClass();
                            pt = (IPoint)ifMerged.ShapeCopy;
                            sRef = pt.SpatialReference;

                            IPoint fromPoint = new PointClass();
                            IPoint toPoint = new PointClass();
                            fromPoint = pcTempPair.get_Point(0);
                            toPoint = pcTempPair.get_Point(1);

                            IPolyline5 ipPairLine = new PolylineClass();
                            ipPairLine.ToPoint = toPoint;
                            ipPairLine.FromPoint = fromPoint;
                            ipPairLine.Project(sRef);
                            IGeometry igPairLine = (IGeometry)ipPairLine;
                            IRelationalOperator relOperatore = (IRelationalOperator)gbBaseMap;
                            Boolean contain = relOperatore.Contains(igPairLine);


Viewing all articles
Browse latest Browse all 1374

Trending Articles