I came across some hack code that I wrote from a few years back that I need rewrite in c#. At the time, I couldn't find property/method that would tell me if a layer was actually visible on the map. As opposed to the ILayer.Visible property which is the potential for a layer to be visible. IMapLayers.IsLayerVisible looked promising but it didn't return the expected values.

My ESRI incident didn't have a related bug and the resolution to that incident was my own hack that I provided.

How are others obtaining this information about a layer's true visibility within a map?

When I said true visibility, I meant that if a layer was visible and it's parent/grandparent/etc are visible too. 'True visibility' was a poor choice of words on my part, because it could be interpreted as a visible layer that has features within the current extent (which is not what I need).

  • Last time I checked, could not find this in AO API. Ended up having to write my own method (rather hacky) which would determine if all layer's parents were visible AND not outside their visibility scale range.
    – Petr Krebs
    Oct 12 '10 at 17:20
  • 2
    I've did some actual testing yesterday and today and IMapLayers.IsLayerVisible now does this as does IMapLayers2.IsLayerVisibleEx (new for 10: goo.gl/smiV). It wasn't working as advertised in previous versions(it may have been @9.2 where I had unsuccessfully attempted to use IMapLayers.IsLayerVisible). goo.gl/BzMU Oct 12 '10 at 18:29

At ArcGIS 10, there's the shiny new interface IMaplayers2, with the IsLayerVisibleEx method. The documentation) for it is ... thin. The documentation for IsLayerVisible states:

This method determines if a layer is actually visible in a map. It does this by checking to see if the layer is not drawn due to scale ranges and also by validating whether or not the layer is in a composite layer or group layer that is not visible.

I can only assume that this would be the same, except now it tells you if the layer is visible and if its parent (if any) is visible.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.