Finding Nearest Feature Methods VB ArcObjects

OK so my co-worker helped me figure this out...

Turns out I hadn't declared an envelope for my featureIndex, which in turn, left my indexQuery empty.

Underneath:

    Dim pNhdIndexQuery As IIndexQuery2

I added the following lines of code:

    Dim pEnvelope As IEnvelope
    Set pEnvelope = New Envelope
    pNhdFeatureIndex.Index Nothing, pEnvelope

This comes before:

    Set pNhdIndexQuery = pNhdFeatureIndex

You also need to ensure that the projections of your data frame, sourceindex, and inpoints all match, lest you catch an error.

Hope this helps,

DR

Tags:

Vba

Arcobjects