Identify features also support FeatureCollectionLayer

285
3
12-11-2017 03:12 AM
TakahiroKAMIYA
Esri Contributor

Does IdentifyLayerAsync Method also support FeatureCollectionLayer?

https://developers.arcgis.com/net/latest/forms/guide/identify-features.htm

https://developers.arcgis.com/net/latest/ios/api-reference//html/T_Esri_ArcGISRuntime_Mapping_Featur...

The GeoElement list is empty.

var layer = MyMapView.Map.OperationalLayers[0];
var pixelTolerance = 20;
var returnPopupsOnly = true;
var maxResults = 1;

var idResults = await MyMapView.IdentifyLayerAsync(layer, e.Position, pixelTolerance, returnPopupsOnly, maxResults);

foreach (GeoElement idElement in idResults.GeoElements)
{
     Feature idFeature = idElement as Feature;
     //idLayer.SelectFeature(idFeature);
}

FeatureCollectionLayer idLayer = idResults.LayerContent as FeatureCollectionLayer;

FeatureCollectionTable tables = (idLayer.FeatureCollection.Tables).FirstOrDefault();

var fields = tables.LayerInfo.Fields;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos
3 Replies
dotMorten_esri
Esri Frequent Contributor

The FeatureCollectionLayer is a group layer of FeatureLayers, so instead parse in the layers inside the collection. Ie

var sublayer = ((FeatureCollectionLayer)layer).Layers[0];

var idResults = await MyMapView.IdentifyLayerAsync(sublayer, e.Position, pixelTolerance, returnPopupsOnly, maxResults);

dotMorten_esri
Esri Frequent Contributor

...actually did you look at the idResults.SublayerResults ? Come to think of it, your geoelements might just be in there.

TakahiroKAMIYA
Esri Contributor

Hello Morten,

Thank you for the information.

var layer = MyMapView.Map.OperationalLayers[0];

var idResults = await MyMapView.IdentifyLayerAsync(layer, e.Position, pixelTolerance, returnPopupsOnly, maxResults);

We were able to get elements of GeoElements from idResults.SublayerResults.

Thank you very much!

0 Kudos