[OpenLayers-Users] Async layer loading

Andreas Hocevar ahocevar at opengeo.org
Wed Nov 23 03:08:50 EST 2011


The layer loading order in OpenLayers since 2.11 is to start loading
from the top to the bottom of the layer stack - other way around than
in 2.10. So if you're using an older version, upgrading to 2.11 will
improve the situation.

However, if this still isn't enough, you can force layer A to not
start loading before layer B is fully loaded:

var a = new OpenLayers.Layer.WMS("A", "a/wms?", {layers: "A"});
var b = new OpenLayers.Layer.WMS("B", "b/wms?", {layers: "B"});
b.events.register("loadend", this, function() { map.addLayer(a); });
map.addLayer(b);

Andreas.
On Wed, Nov 23, 2011 at 8:33 AM, Dragan Podvezanec
<dragan.podvezanec at gmail.com> wrote:
> Hi all.
>
> I have map with 3 wms layers.
> Two of them are overlays. One overlay (let's say layer A) is a
> non-transparent JPEG (aerial imagery) from slow WMS server. Layer B is
> transparent PNG layer from fast WMS server, and it is always loaded faster
> than layer A. since layer A is not transparent, it has to be "below" layer
> B.
> But what happens now, that layer B doesn't show before layer A, and that can
> take some long unnecessary time. Can I somehow "force" layer B to show, even
> if layer A still isn't loaded?
>
> --
> View this message in context: http://osgeo-org.1803224.n2.nabble.com/Async-layer-loading-tp7023471p7023471.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
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


More information about the Users mailing list