I am setting shape file's FeatureSource.FeatureIdsToExclude to add some feature ids to exclude some features when I load the shape file. On the map, I have a map_click event to highlight the closest feature that near the point user clicked on.
It has been working fine if this property is not set. However, when some featureIds added to FeatureIdsToExclude, GetFeaturesNearestTo is not working properly. It's always at specific features on the map I click, GetFeaturesNearestTo function is returning 0 feature. It is happenning like for 5% of the features on the map. By the way, every features in this shape file layer is PointShape. If I use GetFeaturesWithinDistanceOf function, it's returnning the features that were having problem in GetFeaturesNearestTo function, but I don't want to use this function because it is not returning the closest feature.
I have tried the extension method in the other post that allow you to pass distance parameter to GetFeaturesNearestTo function, it is also having the same problem.
For the featuresIdsToExclude property ,if you add some Ids to it, the final result of query will filter out those ids. So for the API GetFeaturesNearestTo function, its returning result may not equals to numberOfItemsToFind. See following examples: