FromPoint does not intersect it's own IPolyline5

562
5
02-07-2012 02:00 AM
SystemDevelopment_ZA
New Contributor
I have a Polyline and a Point FeatureClass. I create a point feature on the Point layer for both the FromPoint and the ToPoint of the IPolyline5 similar to below:

IFeature pointFeature1 = pointFeatureClass.CreateFeature ();
pointFeature1.Shape = polyline.FromPoint;
IFeature pointFeature2 = pointFeatureClass.CreateFeature ();
pointFeature2.Shape = polyline.ToPoint;

Later, I then run both the from point and to point geometries through a method like the below to find all the intersecting polyline features from the polyline feature class.

ISpatialFilter filter = new SpatialFilter ();
filter.Geometry = pointGeometry;
filter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
IFeatureCursor cursor = lineFeatureClass.FeatureClass.Search (filter, false);

At the very least, the intersect filter should find the polyline off which I got the 2 points. The strange thing is, it works for the FromPoint, but not with the ToPoint.

Both feature classes are using the same projection and Geographic Coordinate System and Projected Coordinate System.

I hope I am doing something stupid, but just can't figure out what.

Using ArcEditer 9.3.1

SO: http://stackoverflow.com/questions/9175096/frompoint-does-not-intersect-its-own-ipolyline5
0 Kudos
5 Replies
WeifengHe
Esri Contributor
Can you please try esriSpatialRelEnum.esriSpatialRelTouches instead of using esriSpatialRelEnum.esriSpatialRelIntersects and see what happen?
0 Kudos
SystemDevelopment_ZA
New Contributor
Hi. Thank you.

Using esriSpatialRelTouches got more positive results, however, there were still a lot of instances where it fails.

I got it to work consistently with esriSpatialRelIntersects by just buffering the point feature by 0.001.
0 Kudos
WeifengHe
Esri Contributor
Just one question, the polylines you used to create those fromPoint and ToPoint, are they from existing database, or you just created on the fly?  are the tolerance for the two spatial reference the same?
0 Kudos
SystemDevelopment_ZA
New Contributor
Yes, they are exactly identical.
0 Kudos
WeifengHe
Esri Contributor
Is it possible that you share the data?  You can identify those not work as expected. 

Thanks.
0 Kudos