Select to view content in your preferred language

Check to see if Layer is visible at current map extent

3644
2
Jump to solution
05-20-2016 03:20 PM
AdamCrateau1
Regular 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 Emeritus

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 Emeritus

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;

}

AdamCrateau1
Regular Contributor

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

0 Kudos