Select to view content in your preferred language

GetFeatures return wrong results

796
9
04-29-2025 11:30 PM
sonj
by
Occasional Contributor

The iterating points of the tool. Point is taken by the function, which then retrieves the features at that point. What might be the cause of the persistent variations in the results?

SelectionSet selectionSet = MapView.Active.GetFeatures(mapPoint, true, false);

Dictionary<MapMember, List<long>> result = selectionSet.ToDictionary();
foreach (var entry in result)
{
    MapMember layer = entry.Key;
    List<long> ObjectIDs = entry.Value;

    foreach (long OID in ObjectIDs)
    {
        dat.Add(string.Format("{0}{1}: {2}{3}", "{\"", layer.Name + "\"", OID, "}"));
    }
}
Tags (1)
0 Kudos
9 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

You use visual intersecting in GetFeatures method. Maybe some features aren't visible at some scales? Try false instead true.

Next thing is geometry in GetFeatures method. Check your mapPoint spatial reference. If needed, project mapPoint to map spatial reference.

0 Kudos
sonj
by
Occasional Contributor

Hello @GKmieliauskas As suggested visualintersect is set to false and ran the tool but the results are same.

results.png

0 Kudos
GKmieliauskas
Esri Regular Contributor

Try to set whollyWithin parameter to true.

0 Kudos
sonj
by
Occasional Contributor

The results remains same 😞

0 Kudos
GKmieliauskas
Esri Regular Contributor

Try to check mapPoint of each round with debugger watch.  Is type of mapPoint exactly MapPoint  or maybe it is Multipoint type?

Have you tried your code on not utility network layers?

0 Kudos
sonj
by
Occasional Contributor

The process collects all the line endpoints and then iterates. So it sends a single point. My data is in a shapefile.

0 Kudos
GKmieliauskas
Esri Regular Contributor

All samples of GetFeatures use only geometry parameter. Try overload with geometry parameter only.

Have you tried GetFeaturesEx method? 

0 Kudos
sonj
by
Occasional Contributor

I tried all the options but the results vary.

0 Kudos
sonj
by
Occasional Contributor

Appreciate it if anyone could help us.

0 Kudos