Select to view content in your preferred language

Identify features from a FeatureCollectionLayer

1286
2
05-09-2017 09:04 PM
IraCunningham
Deactivated User

I am adding features to my map by manually creating a FeatureCollectionLayer from a JSON webservice.  Now I am not able to identify features on my map once they are tapped.  The IdentifyLayerAsync method seems will not return any GeoElements.

I am using the exact same code on a FeatureLayer and it works perfectly. 

Does the process change for a FeatureCollectionLayer?

2 Replies
IraCunningham
Deactivated User

After further research, it appears that identify is only available on Feature Layers and Graphic Layers.  Features in a FeatureCollectionLayer are not capable of having GeoElements identified.

TonyWakim
Esri Contributor

For identifying on FeatureCollections, try checking the SublayerResults...

something like this:

if (identifyLayerResult.SublayerResults?.Count > 0)

{

foreach (var sr in identifyLayerResult.SublayerResults)

{

if (sr.Popups?.Count > 0)

{

identifyInfoString += sr.LayerContent.Name + ": --> " + sr.Popups.Count + " features identified." + Environment.NewLine;

}

else

{

identifyInfoString += sr.LayerContent.Name + ": --> " + sr.GeoElements.Count + " features identified." + Environment.NewLine;

}

}

}