Check to see if Layer is visible at current map extent

2818
2
Jump to solution
05-20-2016 03:20 PM
AdamCrateau1
Occasional Contributor

Is there a way to verify if a layer in the map is visible at the current map extent?   FeatureLayer has a .maxScale property which can be used for this.  I don't see anything similar for the LayerInfo class.   Thanks for any suggestions.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Adam,

LayerInfo has a maxScale and minScale. The WAB LayerInfos object you can get by using

LayerInfos.getInstance(this.map, this.map.itemInfo).then(lang.hitch(this, function(operLayerInfos) {

code as referenced in the LayerInfos class—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers

will allow you to get

array.forEach(operLayerInfos.getLayerInfoArray(), function(layerInfo) {

   var isVisible = layerInfo.layerObject.visibleAtMapScale;

}

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Adam,

LayerInfo has a maxScale and minScale. The WAB LayerInfos object you can get by using

LayerInfos.getInstance(this.map, this.map.itemInfo).then(lang.hitch(this, function(operLayerInfos) {

code as referenced in the LayerInfos class—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers

will allow you to get

array.forEach(operLayerInfos.getLayerInfoArray(), function(layerInfo) {

   var isVisible = layerInfo.layerObject.visibleAtMapScale;

}

View solution in original post

AdamCrateau1
Occasional Contributor

The layerObject property appears to expose all the underlying FeatureLayer properties -- exactly what I needed, Thank you!

0 Kudos