ThinkGeo.com    |     Documentation    |     Premium Support

Getting selected features across all layers

Currently I can get selected features in one layer by doing something like:

ShapeFileFeatureLayer Layer2 = (ShapeFileFeatureLayer)Map1.FindFeatureLayer("layernamehere");

Layer2.Open();
ObservableCollection<Feature> features = new ObservableCollection<Feature>(Layer2.QueryTools.GetFeaturesInsideBoundingBox(rectangleShape, ReturningColumnsType.AllColumns).ToList());
Layer2.Close();

Is there a way to get all selected features across all layers without looping through each one, getting the features of that layer, adding to the collection, and going on to the next one?

Hi Dan,

Our query logic is based on layer, so I think the only solution is loop all layers and query one by one.

If you want to query one time, the other workaround is get all features from its original layer, and put them into the same layer for example an inmemoryfeaturelayer, you don’t need to render it, just keep it in memory and query based on this layer.

Wish that’s helpful.

Regards,

Ethan