[OpenLayers-Users] Force to redraw base WMTS layer on moveend deos not work

mikeluz paweluz at o2.pl
Fri Feb 22 03:08:20 PST 2013


Hi

I have 5 base layers. Layer number 1 is always visible (I used
changebaselayer event for that - lets call this layer background layer). My
goal is to provide a tool for setting the opacity of all the other base
layers. User can switch base layers and change each opacity (min one layer
can be visible - just background layer, max 2 layers can be visible -
background and other). Of course OL is implemented like that, that there can
be just one base layer in use (map.setBaseLayer(layer) - it is the main
layer). I have to refresh the background layer on my own e.g. when I have
second layer ON with opacity 0.5 and do zooming or panning background layer
does not refresh. To refresh it I used listener "moveend" like that:

/       this.map.events.register('moveend', this, this.moveMapListener);

       moveMapListener: function (evn) {
           this.map.redrawBaseLayer();
       },

       redrawBaseLayer: function (event) {
           console.info("redraw");
           this.map.layers[0].mergeNewParams({
               'timestamp': Math.random()
           });
           this.map.layers[0].redraw();
       },/
		
It almost work. It works when:
- I do some navigation on background layer
- switch to second layer, change the opacity - layers matches!
- I do some panning zooming - layers match! Background layers is refreshed

PROBLEM:
- I move back to my background layer
- I do some panning
- I switch to second layer again (its opacity is still remembered and set to
0.5) and I can see that layers DOES NOT MATCH! 
- I do some panning - base layer is still not refreshed (although I can see
in firebug that method is called)
- I do zomming and then layer gets refreshed!!!

So it does not work on moveend but it does work on zoomend?!?!

Any idea why it is like that? Do I do something wrong?

cheers,
Pawel




--
View this message in context: http://osgeo-org.1560.n6.nabble.com/Force-to-redraw-base-WMTS-layer-on-moveend-deos-not-work-tp5036105.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list