findlayer and set QueryLayerIndex for layer in layergroup?

Topics: Algorithms, SharpMap v0.9 / v1.x, WinForms Controls
Jun 11, 2013 at 10:34 AM
Edited Jun 11, 2013 at 11:07 AM
How to findlayer and set QueryLayerIndex for layer in layergroup?
because when i use mapBox1.Map.Layers.IndexOf(mapBox1.Map.Layers["layerG"]) , return -1 to me.... and i can't use layer in layergroup....
Coordinator
Jun 12, 2013 at 6:51 AM
I'm afraid that is not possible. Using MapBox's QueryLayerIndex is limited to top level layers. However, if you set the layer index to the layergroup that contains your layer if interest, that layer is queried as well (You may set IsQueryEnabled on LayerGroup). After that you only have to pick the right table from the resulting FeatureDataSet.

Or you set MapQueryMode to AllLayers and your result should be in the returned set of FeatureDataTables.

Hth FObermaier