[OpenLayers-Users] map.setLayerIndex weirdness
PORTER.DANIEL
PORTER.DANIEL at flsenate.gov
Fri Aug 5 12:35:38 EDT 2011
setLayerIndex does work, but it is contingent on when the function is called. We're allowing users to use a control to query a point on the map, and saving the most recent query in a vector layer.
First, I tried to set the layer index immediately after the layers were added to the map. This didn't work.
Next, I ran the function in firebug to make sure that it did what I thought it did. This worked: I made the vector layer foremost on the map. This got me thinking that it was timing contingent.
To "solve" the problem, I added an "activate" event to my query control which called setLayerIndex. This made it work. I don't understand why this would be timing contingent, but based on my
I can post code, but I don't know what code to post ;) If no one on the list sees an explanation for this behavior, when I get some time I'll just check out a dev version of openlayers and look at it more in-depth.
Thanks,
Daniel
From: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] On Behalf Of Marc Jansen
Sent: Friday, August 05, 2011 4:40 AM
To: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] map.setLayerIndex weirdness
Hi Daniel,
I failed to reproduce that map.setLayerIndex(<layer>, 3); doesn't work. I used http://www.openlayers.org/dev/examples/example.html as an example.
Maybe you can share some more code that enlightens the problem.
Best regards,
Marc
On 04.08.2011 16:15, PORTER.DANIEL wrote:
I'm trying to set a vector layer to be on top of all of the other layers.
This is part of my init function:
map.addLayers([base_layer, water, census, vector_layer]);
map.setLayerIndex(vector_layer, 3);
but it doesn't work. When I run map.setLayerIndex(vector_layer, 3) in firebug after the page has finished loading, it works.
Is there something that has to occur before I can set the layer index?
Thanks,
Daniel
_______________________________________________
Users mailing list
Users at lists.osgeo.org<mailto:Users at lists.osgeo.org>
http://lists.osgeo.org/mailman/listinfo/openlayers-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20110805/20b318f7/attachment-0001.html
More information about the Users
mailing list