Change visibility of layer at a particular map scale.

1001
4
Jump to solution
08-09-2019 08:05 AM
ADITYAKUMAR1
Occasional Contributor III

Hi,

  I am changing the map extent and I want at a particular map scale the layer visibility should be turned off.

if (level > 0) {
topic.subscribe("LayerInfos/ExtentChange", lang.hitch(this, function (cur, evt, vs) {

var scale = evt.lod.scale;
if (layerInfo.initVisibaleAtScale == true) {
console.log(layerInfo.title);

As of now I am just able to check if its visible at a scale. Instead I want to set the visibility off.(3.x)

Thanks

Kumar

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ADITYAKUMAR1
Occasional Contributor III

I was able to resolve it by this.map.selectablelayer[2].visible = false;

Thanks for all the support.

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

Kumar,

   It would look something like this:

if(scale >= x) {
  map.getLayer(layerInfo.id).hide();
}
ADITYAKUMAR1
Occasional Contributor III

Hi Robert,

  But I dont have any hide() option available. 

0 Kudos
ADITYAKUMAR1
Occasional Contributor III

I was able to resolve it by this.map.selectablelayer[2].visible = false;

Thanks for all the support.

0 Kudos