[OpenLayers-Users] Change the style of scaletext

Andreas Hocevar andreas.hocevar at gmail.com
Tue Dec 1 03:26:44 EST 2009


It is possible, but not very elegant:

var scaleControl = map.addControl(new OpenLayers.Control.Scale(null, {
    updateScale: function() {
        var scale = scaleControl.map.getScale();
        if (scale) {
            scaleControl.element.innerHTML = "1 : " +
                OpenLayers.Number.format(Math.round(scale), 0, ".");
        }
    }
}));

Regards,
Andreas.

Rahn Hanno (rahn) wrote:
>
> Hello list,
>
> Today I have another short question to you. In my map I use a scalebar
> and a scaletext.
> It looks like this:
>
> Bild (Geräteunabhängige Bitmap)
>
> But now I want to have a text like this: 1:500.000
> Is there any possibility to change the scale text to this with some 0
> and without the "K". Perhaps it is possible too to change the text. I
> think it is enough to write 1:500.000 without the "k" and without the
> "scale ="
>
> For your help a lot of thanks.
>
> Greetings
> Hanno Rahn
>
> ------------------------------------------
> 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