[OpenLayers-Users] RS: Change server wms layer depending resolution

François Van Der Biest f.vanderbiest at gmail.com
Sat Jan 3 03:14:53 EST 2009


Hi Antoni,

If your scale-dependent WMS serves as a background layer, you could try
something like this, with custom boundary resolutions:

map.events.register('zoomend', this, function() {
  var res = map.getResolution();
  if (res <= 3) {
    map.setBaseLayer(orthoLayer);
  } else if ((res <= 12) && (res > 3)) {
    map.setBaseLayer(communLayer);
  } else {
    map.setBaseLayer(gmapLayer);
  }
});

... but we lack here the 'zoomstart' event, which would be more appropriate
IMO.

HTH,
F.


2009/1/2, Vidal, Antoni <antoni.vidal at icc.cat>:
>
> Thank's David.
>
> You know any example code how to implement a scale-dependent WMS layer?.
>
> Thank's again.
>
> Antoni Vidal.
>
>
> -----Missatge original-----
> De: David Fawcett [mailto:david.fawcett at gmail.com<david.fawcett at gmail.com>
> ]
> Enviat el: dv. 02/01/2009 16:56
> Per a: Vidal, Antoni
> A/c: users at openlayers.org
> Tema: Re: [OpenLayers-Users] Change server wms layer depending resolution
>
> Antoni,
>
> If you also control the WMS and are serving up your own data, you
> could use a scale-dependent WMS layer as your source.
>
> You could also potentially build a WMS layer that cascades the data
> from the two external WMS', using scale to determine which data source
> to use.  That said, this would likely be a performance hit, you would
> probably do better to write some custom javascript code to accomplish
> it on the client side.
>
> David.
>
>
>
> On Fri, Jan 2, 2009 at 7:39 AM, Vidal, Antoni <antoni.vidal at icc.cat>
> wrote:
> > Hi there,
> >
> >
> >
> > I would change the server of a wms layer depending of map's resolution.
> Is
> > this possible ?, if yes, any help will be thankfull.
> >
> >
> >
> > Happy 2009.
> >
> >
> >
> > Antoni Vidal
> >
> > Institut Cartogràfic de Catalunya    Tel: +34-93 567 1500 Ext. 3228
> >
> > Parc de Montjuïc                             Fax: +34-93 567 1567
> >
> > 08038 Barcelona                            http://www.icc.cat
> >
> > Spain
> >
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
> >
> >
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090103/3572df7e/attachment.html


More information about the Users mailing list