[mapguide-users] Using Mapguide OS with OpenLayers Setting Layer
Visibility
Mike Adair
madair at dmsolutions.ca
Fri Feb 26 09:55:00 EST 2010
Pietro is correct about how to set those 'showLayers' and 'hideLayers'
params. You might also want to have a look at Fusion
(http://trac.osgeo.org/fusion/) which already implements much of the
framework code to do things like that.
Mike
Pietro Ianniello wrote:
> 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
> <mailto: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 <mailto:mapguide-users at lists.osgeo.org>
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>
--
Michael Adair
Senior Software Architect
DM Solutions Group Inc.
Office: (613) 565-5056 x26
madair at dmsolutions.ca
http://www.dmsolutions.ca
http://research.dmsolutions.ca
More information about the mapguide-users
mailing list