[mapguide-users] Using Mapguide OS with OpenLayers Setting Layer Visibility

Pietro Ianniello pietro.ianniello at gmail.com
Fri Feb 26 06:49:55 EST 2010


You must get layers object ids on server side, something like:

           string strLID= mgMap.GetLayers().GetItem("*LAYER NAME*
").GetObjectId()

they depend on mapguide session.

the use these object ids as params to OpenLayers'layer params
showLayers,hideLayers.

For example

visible laye obj id:  "LVID1"

invisible layers id: "LVID2","LVID3"

OpenLayers layer var: var myLayer;

myLayer.params.showLayers = "LVID1";
myLauer.params.hideLayers = "LVID2,LVID3"; //comma separated values
myLauer.redraw(true);


Regard,

Pietro Ianniello

On Fri, Feb 26, 2010 at 12:00 PM, durrrr <paul.nicholson at capita.co.uk>wrote:

>
> Hi,
>
> I am using OpenLayers as my front end to a MapGuide OS map. I have created
> a
> map using maestro which consists of 5 different layers and this map is
> rendered in OpenLayers as 1 image (The Base Layer).
> I have queried the MGOS API and have brought back a list of all of the
> layers that make up the base layer, and now i want to be able to switch
> individual layers off. I have tried this using the SetVisible() method but
> this doesnt seem to work. In the firebug console it says the layer is
> visible:false but it still shows on the map... I am using php to query the
> api and javascript\ajax on the layerswitcher and to refresh the map.
> If anyone has any suggestions i would appreciate there help.
>
> Thank You
>
>
> --
> View this message in context:
> http://n2.nabble.com/Using-Mapguide-OS-with-OpenLayers-Setting-Layer-Visibility-tp4638383p4638383.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20100226/319a4076/attachment.html


More information about the mapguide-users mailing list