[OpenLayers-Users] Question on having multiple layers

Lee Keel lee.keel at uai.com
Wed Aug 8 12:05:19 EDT 2007


> -----Original Message-----
> From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
> On Behalf Of Ali Khan
> 
> 
> Is there anyway one can make a select box on the page and on change have
> it reference the appropriate layer to show in OpenLayers?
> Also for each layer we want to have a seperate getFeatureinfo query as
> each layer contains different data. How do we do this? can we do
> layer.events.register instead of map.events.register for instance so
> that each layer has its own on click event?
> 
What we are currently doing is catching the map click and getting a list of
all visible layers and layers that are in range.  Something like:

var layers = "";
for (var i = 0; i <  map.layers.length; i++){
  map.layers[i].inRange + " - " + map.layers[i].displayOutsideMaxExtent);
  if (map.layers[i].visibility == true && map.layers[i].inRange == true ){
     if (layers == "") layers = map.layers[i].name;
     else layers = layers + ", " + map.layers[i].name;
   }
}

Then, we have queries in the configuration file that are related to each
available layer so that we can make spatial queries to the appropriate
tables at the given XY (of course + some buffer). 
This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the sender. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail.



More information about the Users mailing list