Select to view content in your preferred language

Query all ENC features on a single click

45
0
4 hours ago
Labels (2)
MattAshman96
New Contributor

I have this code that works well for querying the ENC feature that is clicked on. 

 

What I want to do, is be able to display information on every feature that is located at the clicked-on point (common case is you have a buoy with a light, so I want to be able to display the information about the light and the buoy). I would create a custom popup window for this.

 

I would have thought I'd achieve this by iterating through the firstResult.GeoElements list - but that only contains the feature at the top level and not all the features underneath as well.

 

Is there any way to achieve what I am after?

 

Thanks

IReadOnlyList<IdentifyLayerResult> results = await _mapView.IdentifyLayersAsync(e.Position, tolerance, false);
IEnumerable<IdentifyLayerResult> encResults = results.Where(result => result.LayerContent is EncLayer);
IdentifyLayerResult firstResult = encResults.First();
EncLayer containingLayer = (EncLayer)firstResult.LayerContent;
EncFeature encFeature = (EncFeature)firstResult.GeoElements.First();
containingLayer.SelectFeature(encFeature);
StringBuilder sbAttr = new StringBuilder();
foreach (var item in encFeature.Attributes)
{
				sbAttr.AppendLine(item.Key + ":  " + item.Value);
}
CalloutDefinition definition = new CalloutDefinition(encFeature.Description, sbAttr.ToString());
_mapView.ShowCalloutAt(e.Location, definition);
0 Kudos
0 Replies