Greetings,
I have:
(a) point feature class
(b) polyline feature class
I am trying to loop through the (a) point feature class to find the nearest feature from the (b) polyline feature class.
Just as a start to more complex command, I'd like to find and select the nearest (b) polyline, and create a message box that tells me its ObjectID, just so I know that the method for finding the nearest line is working.
I've come across 2 options, both of which I'm having issues with.
(1) The IIndexQuery.NearestFeature method, which I could use in combination with the IFeature.GetFeature method to select the polyline feature of interest.
I've successfully entered the parameters (I think), but the NearestFeature method returns a "-1" for each of the features FIDs. This makes sense, because my features have an 'ObjectID' field, but no 'FID' field. Is there a way around that? Or does the NearestFeature method only check for FID?
(2) The IHitTest.HitTest method, which returns a segment index of the nearest feature.
The problem here is that I'm looking for a value in a field for the whole line, not just a segment of the line. Is there a way to return the whole feature from the segment index?
Any other suggestions on finding the nearest line from a given point?
Thanks so much,
DR