[mapserver-users] How to get Layers By Group
Venkat Rao Tammineni
vtammineni at roulacglobal.com
Thu Feb 5 20:15:59 PST 2009
Dear Gregor,
Thanks for your great response.
The below is my code to retrieve layer based on layer index and I am
populating into checkboxes
for (int i = 0; i < map.numlayers; i++)
{
layer = map.getLayer(i);
cbLayer.Items.Add(layer.name); //checkbox
if (layer.status == (int)mapscript.MS_ON)
{
cbLayer.Items[i].Selected = true; //check box
}
}
Like that how can I populate layer names based on group into check box or
treeview.
Thanks
Venkat.
-----Original Message-----
From: Gregor at HostGIS [mailto:gregor at hostgis.com]
Sent: Friday, February 06, 2009 9:31 AM
To: Venkat Rao Tammineni
Cc: mapserver-users at lists.osgeo.org
Subject: Re: [mapserver-users] How to get Layers By Group
Venkat Rao Tammineni wrote:
> How can I retrieve layers by Group Name. And how to loop these
> layers based on group. Where I can able to switch on and swatch off the
> layers based on Group.
A group is just a "fake layer" with many layers. You request a group in
the same way as you would a layer; the only change is that you use the
group name and will get all the layers mixed together.
Example:
LAYER
NAME "roads"
GROUP "usamap"
END
LAYER
NAME "lakes"
GROUP "usamap"
END
LAYER
NAME "cities"
GROUP "usamap"
END
I would then request "layers=usamap" and magically get all three layers
merged into one request.
> I have Group property in my mapfile .but I don't
> know how to get layers and populate some control
As to generating a control, that's the same as with layers as well
except that you would use getAllGroupNames() instead of
getAllLayerNames() But that depends on your own programming style and goals.
--
Gregor Mosheh / Greg Allensworth BS, A+, Network+, Security+, Server+
System Administrator, Lead Programmer
HostGIS development & hosting services, http://www.HostGIS.com/
"Remember that no one cares if you can back up,
only if you can restore." - AMANDA
More information about the MapServer-users
mailing list