Thanks for your proposal. In this case, this means that one layer is deleted and replaced by another. Ideally, in order, for example, to have no impact on a layer tree, I'd like to have one "persistent" layer and make that the data source (WMS or TileCache) changes internally to this layer. One way is maybe to change the visibility of the internal layers. Does it sound realistic ? Cédric
On Thu, Dec 9, 2010 at 7:52 PM, Ryan Williams <[email protected]>wrote: > Cedric, Here's one idea: > I pasted an example below of how I did something similar. This starts the > map with an untiled world map from the WMS. Once the user changes the zoom > level then the WMS layer is removed and the tile cache (GWC) layer is added > to the map. It isn't done with one layer, but it seems to accomplish a > similar goal. hope this helps. > > var worldUntiled = new OpenLayers.Layer.WMS.Untiled( > "Balance Background", wms_path, { > layers: 'world:W_borders', > transparent: false, > isBaseLayer: true > }, > { visibility: false > }); > > var worldTiled = new OpenLayers.Layer.WMS( > "Balance Background", gwc_path, > { > layers: 'world:W_borders', > transparent: false, > isBaseLayer: true > }); > // In your map config, add the worldUntiled layer to the map.... Don't add > the worldTiled layer yet. > > //when the user moves the map.... > worldUntiled.events.on({ > moveend: function(e){ > if (e.zoomChanged){ > map.removeLayer(worldUntiled); > map.addLayer(worldTiled); > } > } > }); > > - Ryan > > -- > Ryan Williams, GISP > GIS Analyst / Programmer > PAQ Interactive Inc. > Monticello, IL www.paqinteractive.com > > > On 12/9/2010 12:33 PM, Cédric MOULLET wrote: > > Hi, > I'd like to create one Layer which can combine a WMS and a TileCache layer. > The WMS or the TileCache layer will be visible depending of the zoom level. > The first resolutions will be handled by the TileCache layer and the other > resolutions will be handled by the WMS layer. > What would be the best way to achieve that ? Is it possible to imagine a > custom layer type that can switch the layer based on the zoom level ? > Thanks in advance for any hints, > Cédric > > -- > Welcome to my world: http://www.cedricmoullet.com/ > My Linked In profile: http://www.linkedin.com/in/cedricmoullet > Twitter: http://twitter.com/cedricmoullet > Home sweet home: > http://map.geo.admin.ch/?crosshair=bowl&zoom=11&X=185241.24219&Y=561288.90625&bgOpacity=0&selectedNode=node_ch.swisstopo.fixpunkte-lage1 > > > _______________________________________________ > Users mailing > [email protected]http://lists.osgeo.org/mailman/listinfo/openlayers-users > > > -- Welcome to my world: http://www.cedricmoullet.com/ My Linked In profile: http://www.linkedin.com/in/cedricmoullet Twitter: http://twitter.com/cedricmoullet Home sweet home: http://map.geo.admin.ch/?crosshair=bowl&zoom=11&X=185241.24219&Y=561288.90625&bgOpacity=0&selectedNode=node_ch.swisstopo.fixpunkte-lage1
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
