Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to load a layer as an overlay and make it initially not visible

    airBoss = new OpenLayers.Layer.Text( "AirBoss Locations", { location:"./airboss.txt"} , {
    visibility: false, isBaseLayer: false, displayInLayerSwitcher: true});
    airBoss.setVisibility = false;

Using this code with or without the additional "setVisibility" line the layer always is visible. Is this a bug in the javascript of open layers or am I doing something wrong.


share|improve this question
up vote 2 down vote accepted

setVisibility() is a function not an attribute. You just need to change the last line of your sample code to airBoss.setVisibility(false)


share|improve this answer
Duh !! Thanks of course. Thanks for the answer I'll try it today. – MB. Aug 12 '12 at 18:20
Works perfeectly now, however even though I have displayInLayerSwitcher: false (changed the code) it still shows it in the layer switcher – MB. Aug 13 '12 at 16:17
@MB - same question was just asked today. check it out.… – Vadim Aug 13 '12 at 17:34
Yeah this is exactly what I have in my script tried with and without the single quote marks. I think it works for WMS layers not text layers though – MB. Aug 13 '12 at 20:55

Your Answer


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.