I was looking at this post (thinkgeo.com/forums/MapSuite/tabid/143/aft/7522/Default.aspx), and I wanted to follow up/clarify the process that is happening.
I am excluding features and then am searching for features based off the x/y of a mouse click. I have it set only to return a single feature since that is all I need, but what I am guessing happens is that the nearest feature is actually excluded, so I get nothing back. I am wondering if there is a way/method where a query like the GetFeaturesNearestTo will continue to search if it initially finds an excluded feature. I thought about something like the code below, but I think it would be very taxing to continue to run this query in a loop until I find a non-excluded feature.
Dim
myFeatures
As
ObjectModel.Collection(Of Feature)
Dim
featureCounter
As
Integer
= 1
While
(myFeatures
Is
Nothing
OrElse
myFeatures.Count = 0)
myFeatures = myQueryShapefile.QueryTools.GetFeaturesNearestTo(pointFeatureFromMouse.GetShape, GeographyUnit.Meter, featureCounter, ReturningColumnsType.AllColumns)
featureCounter += 1
End
While
I could expand out my feature limit to a higher number (like 100) instead of 1 (and instead of using an increment like above), but I am not sure how features are added into the returned collection. If I were to grab the feature at the first index of the collection, would that be the nearest one, or is the returned collection sorted by something like ID?
Is there a better way to go about this, or another process that I am unaware of that is in the software already?