AnsweredAssumed Answered

Spatial Query error

Question asked by iaminsu12 on Nov 15, 2012
Latest reply on Nov 22, 2012 by fridjof
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



                  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);

Outcomes