Short version: is there a way to get a table of all the polygons conatained in a collection of feature layers?
Long version: I'm writing a button add-in for ArcGIS Explorer in C#. On a given map, I have a number of layers that each have one or more polygons. When I click the map, I get an infoWindow that gives me the names of the layers that have polygons that contain the clicked point, which is exactly what I want.
What I want the button to do is create a grid of points, and for each point get a list of names of all the layers whose polygons contain that point. So far, I have everything except the ability to go between layers and polygons. Here's my code:
//Access the map we are using
Map map = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map;
//Instatiate the list that will contain all the info
List<string> bigList = new List<string>();
//Now loop over every 0.01 degree SE to NW
//Between most extreme points in contiguous US
//Note, west is negative
//Most extreme points: 24.44N, 49.39N, -66.94E, -124.74E
for (double lat = 24; lat <= 50; lat += 0.1)
{
for (double lon = -66; lon >= -125; lon -= 0.1)
{
//Make a point, get everything that lives there,
//put it in a list, and record the coordinates!
//string subList = new string();
string stringLat = lat.ToString();
string stringLon = lon.ToString();
//spatial query on lat, lon
ESRI.ArcGISExplorer.Geometry.Point newPoint = ESRI.ArcGISExplorer.Geometry.Point.CreateFromLatitudeLongitude(lat, lon);
//From a tutorial
ESRI.ArcGISExplorer.Mapping.MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
//see what layers exist at that point
System.Collections.ObjectModel.ReadOnlyCollection<FeatureLayer> layers = disp.Map.GetMapItems<FeatureLayer>();
//
//HERE'S THE IMPORTANT PART
//I need to make a table of all the polygons in all the Layers from the collection layers
//That table will eventually be called polygonsFromLayersTable
//
Filter layerFilter = new Filter(newPoint, FilterSearchOptions.Within);
RowCollection goodLayers = polygonsFromLayerTable.Search(layerFilter);
foreach (Row lyr in goodLayers)
{
string name = lyr.Name;
//Then we want the sublist string to have lat lon and name and be a csv
string subList = stringLat + ',' + stringLon + ',' + name + ',';
//Add the sublist to the biglist while still in the loops
bigList.Add(subList);
}
}
}
I hope that my comment makes sense. The idea is that I need a table of polygons in order to make the Search() call, but all I have is a collection of FeatureLayers. Is there a way to get from one to the other? Thanks very much.