I am new to ArcGIS and I am trying to create an Add-In button which can
- figure out which polygons are selected and
- query the selected polygons to generate a report on the underlying metadata (similar to the Identify tool).
I had a look at this article, which helped with finding the selected feature layer, but I haven't been able to progress much further.
Any help would be much appreciated.
At the moment all I have is a one-liner. Here is some pseudo code of what I would like to do:
var featureLayer = ArcMap.Document.CurrentContentsView.SelectedItem as IFeatureLayer; var selectedFeatures = featureLayer.SelectedFeatures; // A list to contain the info available in Identify tool (not sure what this is called) var featuresAttributes = new List<FeatureAttributes>(); // For each selected polygon foreach(var feature in selectedFeatures) featuresAttributes.Add(feature.Attributes); // Go off and generate some report based on the selected polygon attributes MyReportGenerator.CreateReport(featuresAttributes);