[mapguide-users] React Layout - set layer visibility

Jackie Ng jumpinjackie at gmail.com
Wed Jul 14 02:30:43 PDT 2021


MapGuide.Actions.Legend.setLayerVisibility() should be the way to go, but
it's not something you call and the layer will be toggled.

The object returned
by MapGuide.Actions.Legend.setLayerVisibility(sellayer.ObjectId, true) is
something you have to dispatch() on your viewer instance for the toggling
to take effect.

See the "Dispatching redux actions" section of this link:
https://jumpinjackie.github.io/mapguide-react-layout/0.13.0/api_browser.html

- Jackie

You wrote:

Hi Jackie,
many thanks for the new release. In the way I tryed to set the layer
visibility programmaticly I cant find a solution.
MapGuide.Actions.Legend.setLayerVisibility(sellayer.ObjectId, true); or
MapGuide.Actions.Legend.setLayerVisibility(viewer.getMapName(), {id:
sellayer.ObjectId, value: true}); or
sellayer.Visible = true; or
sellayer.ActuallyVisible = true; or

but i found a strange solution:
remove the layer id from viewer.inner.props.hideLayers[]

Is this the right (only) way?


-- 
*Please Note: I no longer create new posts or post replies to any OSGeo
mailing list through nabble. As a result, you most likely won't see this
message appear on nabble's view of any OSGeo mailing list and may only see
this message through mailing list archives or depending on your mailing
list subscription settings, through daily message digests or automated
notifications from the mailing lists.*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapguide-users/attachments/20210714/8f433045/attachment.html>


More information about the mapguide-users mailing list