[OpenLayers-Users] Using setLayerIndex with a TMS Layer does not
seem to work
Matt Davis
matt.w.davis at noaa.gov
Mon Nov 21 13:13:51 EST 2011
Hi List,
I'm hoping someone here can help me to see the error in my code. I am part
of a project building a highly interactive weather monitoring system. As
such, we are using OpenLayers 2.11 as our choice of map engine.
I have 11 layers of radar imagery. Each layer is a different time step. In
order to manage the layering in our application, I need these layers to
always be indices 20 to 30. They are served from a tile mapping server and
created like:
var radar = new OpenLayers.Layer.TMS(thisClass.radarTimes.getItem(i),
thisClass.ridge,
{
layername : thisClass.radarTimes.getItem(i),
type: 'png',
isBaseLayer: false,
getURL: radar_url,
mapType: "radar",
frameTime: new
Date(thisClass.realTimes.getItem(i) * 1000),
displayInLayerSwitcher: true,
opacity: thisClass.getOpacity()
});
This all works fine. I have all layers loaded. However, immediately after
that, I attempt:
thisClass.map.addLayer(radar);
thisClass.map.setLayerIndex(radar, startIndex);
Where this is inside a loop with start index of 20...21...etc.
If I log the actual indices, I can see that the layer is never changing.
for instance:
console.log(startIndex); (Will be as expected: 20)
console.log(thisClass.map.getLayerIndex(radar)); (Will be arbitrary: 4)
If I jump through some hoops to get it accessible through firebug,
Attempting the setLayerIndex results in
TypeError: layer.setZIndex is not a function
+zIdx*5);},resetLayersZIndex:function(...ers.Console.warn(msg);return
false;}}
Any idea what I might be doing wrong?
Thanks,
Matt
--
*Information Technology Officer*
National Weather Service
La Crosse, Wisconsin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111121/20970f78/attachment.html
More information about the Users
mailing list