AnsweredAssumed Answered

SelectFeature for a FeatureCollectionLayer?

Question asked by mikebrown_NCDOT on Jul 27, 2018
Latest reply on Jul 30, 2018 by MStoica-esristaff

I have a collection of features that I create in code to mimic as if my data had a FeatureLayer. I have the Features properly showing up on the map and I can even identify the feature when tapped and output the data from the backing fields. However, I don't see any of the Select methods that are used in FeatureLayers. I prodded around and did find a hack to get to the method call:

 

var identifyResults = await MyMapView.IdentifyLayerAsync(MyFeatureCollectionLayer, tapScreenPoint, pixelTolerance, onlyReturnPopups, maximumResults);

 

var fcl = identifyResults.SublayerResults.FirstOrDefault();
if (fcl != null)
{
        foreach (Esri.ArcGISRuntime.Data.GeoElement idElement in fcl.GeoElements)
        {
            Esri.ArcGISRuntime.Data.Feature idFeature = idElement as Esri.ArcGISRuntime.Data.Feature;

            //fcl.SelectFeature(idFeature); // No methods for selection!!!

            MyFeatureCollectionLayer.FeatureCollection.Tables[0].FeatureLayer.SelectFeature(idFeature);

            CalloutDefinition callout = new CalloutDefinition(idFeature.Attributes["Number"].ToString(), idFeature.Attributes["Location"].ToString());
            MyMapView.ShowCalloutAt(e.Location, callout);
        }
}

However, if I get a reference to that FeatureLayer and try to perform the same IdentifyLayerAsync it won't return any results. Should/will FeatureCollectionLayers have a SelectFeature() method?  Am I using the wrong tooling (for adding POCO data to a map)? I had tried doing this with a GraphicsOverlay but ran into issues with interacting with the data -queries, filters, etc.

Outcomes