Hi Have you tried creating two layers, one with a maxResolution option connected to TileCache, and the other with minResolution connected to MapServer?
Cheers, Eric 2009/2/13, Alessio Di Lorenzo <alessio.dilore...@gmail.com>: > > Hi guys, > > I'm developing a little webgis and I need to use some wms layer that are > requested in two different ways: > > - when the map resolution is <= 305.7481130859375 I want to request the > cached layer (with TileCache) > > - when the resolutione is > 305.7481130859375 I want to send directly the > wms request to mapserver > > I did something like the following > > var res = map.getResolution(); > > if (res <= 305.7481130859375) { > > //use wms request on mapserver > bovini = new OpenLayers.Layer.WMS( "Bovini", > "http://brucellosi.izs.it/cgi-bin/mapserv?", > {map: > '/usr/local/apache2/htdocs/mapfiles/brucellosi_alessio.map', > transparent:'true', layers: 'a_bovini', 'format':'png'}, > {'reproject': false, singleTile:true, isBaseLayer: > false} ); > bovini.setVisibility(false); > map.addLayer(bovini); > > > bovini_q = new OpenLayers.Layer.WMS( "Bovini_q", > "http://brucellosi.izs.it/cgi-bin/mapserv?", > {map: > '/usr/local/apache2/htdocs/mapfiles/brucellosi_alessio.map', > transparent:'true', layers: 'a_bovini_q', > 'format':'png'}, > {'reproject': false, singleTile:true, isBaseLayer: > false} ); > bovini_q.setVisibility(false); > map.addLayer(bovini_q); > > > bovini_p = new OpenLayers.Layer.WMS( "Bovini_p", > "http://brucellosi.izs.it/cgi-bin/mapserv?", > {map: > '/usr/local/apache2/htdocs/mapfiles/brucellosi_alessio.map', > transparent:'true', layers: 'a_bovini_p', > 'format':'png'}, > {'reproject': false, singleTile:true, isBaseLayer: > false} ); > bovini_p.setVisibility(false); > map.addLayer(bovini_p); > > } else if (res > 305.7481130859375) { > > //ask for tilecache tiles on the disk > bovini = new OpenLayers.Layer.WMS( "Bovini", tilecache,{layers: > 'a_bovini'},{isBaseLayer: false} ); > map.addLayer(bovini); > > bovini_q = new OpenLayers.Layer.WMS( "Bovini_q", tilecache,{layers: > 'a_bovini_q'},{isBaseLayer: false} ); > map.addLayer(bovini_q); > > bovini_p = new OpenLayers.Layer.WMS( "Bovini_p", tilecache, {layers: > 'a_bovini_p'}, {isBaseLayer: false} ); > map.addLayer(bovini_p); > > } > > > The problem is that this solution works only in selecting the "starting > source"... > In this case, at the beginning, tilecache is correctly selected as layer > source, but if I zoomIn (and my resolution becames > 305.748...) the layer > is not > requested to mapserver wms but still to tilecache... > -- > View this message in context: > http://n2.nabble.com/asking-the-same-layer-to-mapserver-and-tilecache-depending-on-resolution-tp2321107p2321107.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > > _______________________________________________ > Users mailing list > Users@openlayers.org > http://openlayers.org/mailman/listinfo/users > _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users