[OpenLayers-Users] ZoomToScale

bartvde at osgis.nl bartvde at osgis.nl
Tue Apr 7 10:00:05 EDT 2009


Hi,

OpenLayers will snap the nearest resolution.

Try and use fractionalZoom: true on your map options. This will only work
on layers that do not use a set of fixed resolutions, like WMS. It won't
work on Google, TMS etc.

Best regards,
Bart

> Hello list,
>
>
>
> I have another question. I try to realise a textfield where I can type in
> the scale. I want to type a scale in a textbox or so and then the map
> should zoom to this scale.
>
> I try to make it with the function "zoomToScale" but I don't understand
> it. If I for example set map.zoomToScale(30000) the scale will be set to
> to 50000. If I can trust the "map.addControl(new
> OpenLayers.Control.Scale());"
>
>
>
> I don't know how I can realise it.
>
> My map options looks like this.
>
>
>
> var options = {
>
>             maxExtent: new OpenLayers.Bounds(555100,129900,678450,245000),
>
> //          maxResolution: 'auto',
>
>             maxScale: '500',
>
>             minScale: '500000',
>
>             units: 'm',
>
>             projection: "EPSG:21781" // Switzerland Projected Coordinate
> System
>
> };
>
>
>
> I will zoom from 1:500 till 1:500000, but it must be possible to write
> something like 1:30000 to zoom to the scale.
>
> Can somebody please help me or give me a tip? Perhaps somebody have
> already realise something like this.
>
>
>
> Thank you a lot for your great work.
>
>
>
> Greetings
>
> Hanno
>
>
>
> ------------------------------------------
>
> Hanno Rahn, Dipl.-Ing. (FH) Geoinformatik
>
> ZHAW Zürcher Hochschule für Angewandte Wissenschaften Umwelt und
> Natürliche Ressourcen
>
> Fachstelle Geoinformatik
>
> Grüental, Postfach CH-8820 Wädenswil
>
> Tel +41 (0)58 934 5592
>
> Fax +41 (0)58 934 5580
>
> hanno.rahn at zhaw.ch
>
>
>
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>





More information about the Users mailing list