[OpenLayers-Users] rendering WFS and vectors based on zoom levels

Arnd Wippermann arnd.wippermann at web.de
Fri Dec 18 15:37:19 EST 2009


minScale and maxScale or minResolution and maxResolution should do the
trick.
        function layerGML_BW(title, url, projection)

        {

            var lyr = new OpenLayers.Layer.Vector(title , {

                minScale : 4000,

                maxScale : 50,

                projection: projection,

                strategies: [new OpenLayers.Strategy.Fixed()],

                protocol: new OpenLayers.Protocol.HTTP({

                    url: url,

                    format: new OpenLayers.Format.GML({

                        extractAttributes: true

                    })

                })

            });

            return(lyr);

        }
from http://gis.ibbeck.de/ginfo/apps/planwerk/planwerk_nordbahntrasse.asp
if you zoom into the small recangles, a layer with labels will show up.

Arnd

 
  _____  

Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von Lammie Jonson
Gesendet: Donnerstag, 17. Dezember 2009 22:33
An: users at openlayers.org
Betreff: [OpenLayers-Users] rendering WFS and vectors based on zoom levels



 I figured out how to render WFS from my website using a proxy. The browser
will send a request like this
to the server:
  Parameters: {"url"=>"http://mysite.com?typename=topp%3Astates
<http://mysite.com?typename=topp%3Astates&SERVICE=WFS&VERSION=1.0.0&REQUEST=
GetFeature&SRS=EPSG%3A4326&BBOX=-570.9375,-457.646484375,819.84375,380.47851
5625>
&SERVICE=WFS&VERSION=1.0.0&REQUEST=GetFeature&SRS=EPSG%3A4326&BBOX=-570.9375
,-457.646484375,819.84375,380.478515625"}

 Suppose I only want the content rendered through WFS to only be visible at
lower zoom levels, is there a way to indicate this in openlayers in the
constructor for the WFS layer ?

 I would like to also be able to do that for any other vector data as well.
I could do this in a variety of ways using session data through a cookie or
by somehow checking the map zoom level whenever the map moves. In the case
of WFS, maybe I could somehow figure out the zoom level from the bounding
box, but if there is a more transparent way to do that I would like to do it
that way or whatever is the preferred cleaner approach, etc. 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20091218/2893539c/attachment.html


More information about the Users mailing list