我需要知道如何使用 c# wpf 在 ArcGIS Runtime 中直接获取栅格文件的波段数。我正在使用下面的代码,但有时它没有得到地理元素。请建议是否有任何其他方法可以直接获取栅格波段计数?
IdentifyLayerResult identifyResult = await MapViewModel.MapView.IdentifyLayerAsync(_rasterLayer, position, 0.001, false);
if (identifyResult.GeoElements.Count != 0)
{
List<GeoElement> s = identifyResult.GeoElements.Distinct().ToList();
GeoElement cell = identifyResult.GeoElements.First();
foreach (KeyValuePair<string, object> keyValuePair in cell.Attributes)
{
string band = keyValuePair.Key;
if (band.ToUpper().Contains("BAND"))
bandCount = bandCount + 1;
}
}