Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Repost--I deleted this yesterday when I discovered the answer and remembered this on meta. Had second thoughts this morning, since this might be useful to someone in the future. I'll let this go for a week and provide my own answer if it's unanswered.


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?

Update
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).

share|improve this question
    
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 –  Jay Cummins Oct 12 '10 at 18:29

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
    
great find! thanks –  Petr Krebs Oct 12 '10 at 21:57

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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