Getting actual visibility of layers in map?

161
1
08-16-2018 03:22 AM
by Anonymous User
Not applicable

I'm trying to get the current visibility state of layers in my map but for I've noticed the layer.IsVisible property only returns false if the layer is unchecked in the ToC. It returns true if the layer is out of scale range thus not drawing on the map (and greyed out in ToC).

var layer = (FeatureLayer) _map.Layers.FirstOrDefault(l => l.Name == name);

if (layer == null) return false;

return layer.IsVisible;

  

Is there a way I can get which layers are actually being drawn? (without having to compare scale range and map zoom).

Tags (2)
0 Kudos
1 Reply
UmaHarano
Esri Regular Contributor

Hi

There is a new method available with Pro 2.4 that will allow you to do this:  

FeatureLayer.IsVisibleInView(MapView)

ProSnippet: Check if Layer is visible in the given map view

Thanks

Uma

0 Kudos