Skip to content

Setting layer visibility – map.layers[0].visible not working #153

@wahlatlas

Description

@wahlatlas

I was wondering what the correct way of switching layer visibility was.
Currently for switching hillshading on/off I use

   function showHillShade(show) {

      if (show) {

         map.layers = [hillShade, backgroundLayer, dataLayer]

      } else {

         map.layers = [backgroundLayer, dataLayer]

      }

      map.redraw()

   }

see testcase 153
https://wahlatlas.net/experimente/testcases/gridviz3_issue_153_mapLayersVisible.html

but I was wondering if map.layers[0].visible=true could be used for this as well

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions