A simple scale control that shows the scale of the current center of screen in metric (m/km) and imperial (mi/ft) systems. Extends Control.

Usage example



Factory Description
L.control.scale(<Control.Scale options> options?) Creates a scale control with the given options.


Option Type Default Description
maxWidth Number 100 Maximum width of the control in pixels. The width is set dynamically to show round values (e.g. 100, 200, 500).
metric Boolean True Whether to show the metric scale line (m/km).
imperial Boolean True Whether to show the imperial scale line (mi/ft).
updateWhenIdle Boolean false If true, the control is updated on moveend, otherwise it's always up-to-date (updated on move).
Option Type Default Description
position String 'topright' The position of the control (one of the map corners). Possible values are 'topleft', 'topright', 'bottomleft' or 'bottomright'


Method Returns Description
getPosition() string

Returns the position of the control.

setPosition(<string> position) this

Sets the position of the control.

getContainer() HTMLElement

Returns the HTMLElement that contains the control.

addTo(<Map> map) this

Adds the control to the given map.

remove() this

Removes the control from the map it is currently active on.