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(); });
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.