Hello Mike,

try it without "element".

new OpenLayers.Control.Scale(document.getElementById("mapScale"))

Greetings, Jana.


Am 15.02.2013 03:37, schrieb Mike Melson:
Hi. Newbie to OpenLayers&  I am having trouble getting the Scale control's 
output to show up in a separate element.

My HTML is:
<label>Lon/Lat:</label><span id="lonlat"></span>
<label>Scale:</label><span id="mapScale"></span>


My javascript is:
var map = new OpenLayers.Map('map', {
   center: new OpenLayers.LonLat(-95, 36).transform("EPSG:4326", "EPSG:900913"),
   zoom: 4,
   layers: cdvM.map.layers,
   displayProjection: "EPSG:4326",
   controls:[
     new OpenLayers.Control.Navigation(),
     new OpenLayers.Control.OverviewMap(),
     new OpenLayers.Control.Scale({
       element  : document.getElementById("mapScale")
     }),
     new OpenLayers.Control.ScaleLine(),
     new OpenLayers.Control.LayerSwitcher(),
     new OpenLayers.Control.PanZoomBar(),
     new OpenLayers.Control.MousePosition({
       element  : document.getElementById("lonlat"),
       numDigits        : 4,
       separator        : ", "
     }),
     new OpenLayers.Control.KeyboardDefaults()
   ]
});

The MousePosition Control correctly shows in the lonlat span.
The Scale info doesn't. I tried switching the two&  the MousePosition was able 
to display in the Scale's span.

If this has already been answered, I apologize...I was unable to search the 
archives (got an error): 
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Mike
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to