user721588
user721588

Reputation:

OpenLayers Control ScaleLine - show only meters

I have an application that uses OpenLayers library.

I create a scale line:

map.addControl(new OpenLayers.Control.ScaleLine());

But it shows both meters and fs. I need to show only meters. I add next code to openlayers.css

.olControlScaleLineBottom {
    visibility: hidden; 
}

But it still shows ft. How can I fix it?

Upvotes: 2

Views: 2801

Answers (1)

user1702401
user1702401

Reputation: 1658

You can disable top or bottom part of scaleline by setting topOutUnits or bottomOutUnits to empty string:

map.addControl(new OpenLayers.Control.ScaleLine({bottomOutUnits: ''}));

That behavior is not mentioned in documentation, but you can find it easily, when you look at control's source code.

Upvotes: 5

Related Questions