Strange. Now it works, but only with OSM layer (which is in Spherical Mercator) and it does not work when I use WGS-based layer (e.g. &quot;<a href="http://labs.metacarta.com/wms/vmap0">http://labs.metacarta.com/wms/vmap0</a>&quot;) - in this case scaleline changes between 1000 and 10000 km when I drag a map towards poles.<br>
<br>Regards,<br clear="all">Jan Burdziej<br>
<br><br><div class="gmail_quote">2010/4/28 Bart van den Eijnden <span dir="ltr">&lt;<a href="mailto:bartvde@osgis.nl">bartvde@osgis.nl</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div style="word-wrap: break-word;"><div class="im">Add your control after the call to zoomToMaxExtent.<div><br></div></div><div>Best regards,</div><div>Bart</div><div><font color="#888888"><br></font><div><div class="im">
<div>On Apr 28, 2010, at 2:34 PM, Jan wrote:</div><br></div><div class="im"><blockquote type="cite"><span style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><pre>
        var map, scalebar;<br><br>        function init(){<br><br>            map = new OpenLayers.Map(&#39;map&#39;);<br>            var layer = new OpenLayers.Layer.WMS(<br>
                &quot;OpenLayers WMS&quot;,<br>                &quot;<a href="http://labs.metacarta.com/wms/vmap0" target="_blank">http://labs.metacarta.com/wms/vmap0</a>&quot;,<br>                {layers: &#39;basic&#39;}<br>
            );<br>
            map.addLayer(layer);<br>            <br>                        var scalebar = new OpenLayers.Control.ScaleLine({<br>                                geodesic: true<br>                        });<br>                        <br>            map.addControl(scalebar);<br>            <br>            map.zoomToMaxExtent();<br>

        }</pre></span></blockquote></div></div><br></div></div></blockquote></div><br>