As stated in the title, I'm looking to retrieve the number displayed for feature counts in legends within a layout. How can I achieve this?
How to get this counts
You can get the number of features in a layer using the Pro API's, FeatureClass.GetCount() method.
var featureLayer = MapView.Active.Map.GetLayersAsFlattenedList().OfType<FeatureLayer>().FirstOrDefault(n => n.Name == "TestPoly"); QueuedTask.Run( () => { var featureClass = featureLayer.GetFeatureClass(); var count = featureClass.GetCount(); });
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.