[OpenLayers-Users] Scale text outside the map

Andris Ratas a.ratas at traffic-tim.de
Thu Aug 6 03:12:58 EDT 2009


You don't even need a scale control for that. Just register with "zoomend" event of your map object and add the scale to any div element you need.
 
map.events.register("zoomend", map, function () {
document.getElementById('scale_div').innerHTML = map.getScale().toFixed(0);
});
 
 



Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im Auftrag von Rahn Hanno (rahn)
Gesendet: Donnerstag, 6. August 2009 08:05
An: users at openlayers.org
Betreff: [OpenLayers-Users] Scale text outside the map
 
Hello list,
 
I have another question. Perhaps somebody can help me.
I try to realise a Sclae text. It should be something like this 1:25000. For this I use the Scale Control.
 
var scale = new OpenLayers.Control.Scale({
            div: document.getElementById("kartenElemente")
});
                                   
map.addControl(scale);
 
I want to place the Scaletext outside the map. For this I use the div Option. But it doesn't work. Can somebody please help me? Is there a possibility to place the control outside the map in an extra div?
 
Thank you a lot for your help.
 
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 
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090806/e4c0d7a8/attachment.html


More information about the Users mailing list