Select to view content in your preferred language

Finding the segment of a point on a polyline

885
4
12-15-2010 01:38 AM
orsela
by
Emerging Contributor
I have a polyline geometry and a certain point on the polyline.
I want to find the index of the polyline segment that the point belongs to.

What is the best way to do this?

Thanks
0 Kudos
4 Replies
DuncanHornby
MVP Notable Contributor
Orsela,

The way I would have done this is use the ISegmentCollection and it's property Segment to loop over the collection of ISegments then use something like IProximityOperator to test if the point intersects the segment.

Well that's how I would have done it...

Duncan
0 Kudos
NeilClemmons
Honored Contributor
Use IHitTest.  One of the return parameters of the HitTest method is the segment index.
0 Kudos
orsela
by
Emerging Contributor
Thank you very much!
0 Kudos
DuncanHornby
MVP Notable Contributor
Neil,

IHitTest... never knew about this Interface, ArcObjects just keeps on giving!

🙂

Duncan
0 Kudos