[OpenLayers-Users] Control visibility of multiple layers

Robert Sanson Robert.Sanson at asurequality.com
Mon Sep 24 13:33:57 PDT 2012


Pull them in as separate layers from Geoserver in the first place so you have separate vector layers in OpenLayers.

>>> "Lee M." <w_ward_W at hotmail.com> 25/09/2012 1:58 p.m. >>>

I am displaying many geoserver layers using one layer in OpenLayers, like
here:

  var *vector *= new OpenLayers.Layer.Vector("My Layer", { 
  maxExtent: new OpenLayers.Bounds(-1.09863,44.42907, 91.01074, 2.05840)
  sphericalMercator: true,	
  protocol:  new OpenLayers.Protocol.WFS({  
  url: 'http://mydomain/geoserver/wfs',
  *featureType: ["mylayer_1","mylayer_2","mylayer_3"], 	*
  featureNS: "http://mapmap.org", 
  srsName: "EPSG:3857", 
  version: "1.1.0", 
  extractAttributes: true, 
  isBaseLayer: false, 
  visibility: true 
   })
  });

now I want to make *layer_2* invisible by setVisibility(false).. but I don't
now how to select it. it seems like I just can control the whole layer
(*vector*). 

is there any way to control visibility of these layers ?



--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Control-visibility-of-multiple-layers-tp5004368.html 
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org 
http://lists.osgeo.org/mailman/listinfo/openlayers-users



This email and any attachments are confidential and intended solely for the addressee(s). If you are not the intended recipient, please notify us immediately and then delete this email from your system.

This message has been scanned for Malware and Viruses by Websense Hosted Security.
www.websense.com


More information about the Users mailing list