[OpenLayers-Users] ZoomToScale

Rahn Hanno (rahn) rahn at zhaw.ch
Tue Apr 7 09:56:02 EDT 2009


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 

 

 

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


More information about the Users mailing list