How to get City Engine Object Attributes at Runtime using ArcGIS Runtime SDK for .NET in WPF App

965
1
10-30-2021 05:14 AM
KarthikS
New Contributor II

Hi,

I created the sample WPF application using ArcGIS Runtime SDK for Dot Net.

I loaded the local slpk file with one building which is exported from City Engine.

I cannot able to get that object attributes at runtime which is given in City Engine.

See below figure for what exactly I need?

City Engine SceneCity Engine Scene

 

How to get this object attributes in WPF app, when I click that building?

Already I referred the following link

https://developers.arcgis.com/net/wpf/sample-code/update-attributes-feature-service/

https://developers.arcgis.com/net/wpf/sample-code/scene-layer-selection/

But can not able to get the City Engine object attributes .

My code is below

ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer();

foreach (var sl in MySceneView.Scene.OperationalLayers)
{
if (!string.IsNullOrEmpty(sl.Id))
{
sceneLayer = (ArcGISSceneLayer)sl;

sceneLayer.ClearSelection();

IdentifyLayerResult identifyResult = await MySceneView.IdentifyLayerAsync(sceneLayer, e.Position, 10, false, 1);

IReadOnlyList<GeoElement> geoElements = identifyResult.GeoElements;

if (geoElements.Any())
{
GeoElement geoElement = geoElements.FirstOrDefault();
if (geoElement != null)
{
sceneLayer.SelectFeature((Feature)geoElement);

var _selectedFeature = (ArcGISFeature)identifyResult.GeoElements.First();

string currentAttributeValue = _selectedFeature.Attributes["City"].ToString();
}
}
}
}

above code raise the following exception

The given key 'City' was not present in the dictionary.

Please give us advice

Thanks

 

0 Kudos
1 Reply
KarthikS
New Contributor II

Can anybody suggest the solution for this problem.

Please give us advice.

0 Kudos